This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-15
Channels
- # aws (25)
- # babashka (11)
- # beginners (24)
- # calva (18)
- # clj-kondo (6)
- # cljdoc (1)
- # clojure (48)
- # clojure-europe (3)
- # clojure-houston (1)
- # clojure-uk (22)
- # clojuredesign-podcast (8)
- # clojurescript (9)
- # cursive (8)
- # dirac (6)
- # duct (19)
- # fulcro (17)
- # hoplon (29)
- # mount (3)
- # off-topic (24)
- # pathom (6)
- # re-frame (6)
- # shadow-cljs (5)
- # spacemacs (5)
- # sql (10)
- # tools-deps (7)
- # vim (2)
Hello, currently I'm building an application that manage various schedules for day. My first approach was have a list of task, iterate through this, and then create a schedule for each task, but today I was thinking if this is the best approach and I thought, I could have a list of task, but just create the next schedule when the previous one ends, and thus, I could have just one schedule waiting. What is your opinion about that? Is really best, or there is really not profit? (If you have a link about how you can manage schedule task, I will gratefully)
there is a scheduling library for clojure, http://clojurequartz.info/, but I’m not sure if it’s the same use case you have in mind. can you define what you mean by “task” and “schedule?”
Im using this https://github.com/http-kit/http-kit/blob/master/src/org/httpkit/timer.clj
is a task just a function you want to run?
Yes, in a specific time
This function send a event to a client socket
it kind of depends on how robust you need it to be. scheduling is actually pretty tricky to get right, especially if tasks can fail.
it sounds like you have at least one recurring task. how many periodic tasks do you expect? can scheduled tasks be cancelled?
do tasks have to run at a specific time (eg. 5pm on a sunday) or after a certain amount of time has passed (eg. 3 hours from now)?
The minimum could be 1h, and not be canceled
The taks could change each 24hrs
for both quartzite and the http-kit timer, the scheduled tasks are only stored in memory. is it a big deal if tasks are lost if the server gets restarted or goes down for some reason?
I think have the list in the db, if the server goes down, should be a function to filter just the task with a time positive ( taskTime - now) positive
I think both approaches could work. the main drawback of scheduling the next task after a previous one finishes is that you definitely want to make sure that if the task fails for any reason, it doesn’t prevent the next task from being scheduled
additionally, scheduling the next task after the previous one task finishes assumes tasks don’t overlap.
In terms of CPU or memory usage, there a big difference?
how many tasks are you expecting? I’m imagining that most servers could handle a quite a lot of tasks before it would start to matter
Could be 1000
spread out over 24 hours? I’d be pretty surprised if you were running into performance issues for that amount
Hi there, I'm having trouble accessing a Java nested class in Clojure:
flow (.. (new GoogleAuthorizationCodeFlow$Builder http-transport json-factory client-secrets scopes)
(setDataStoreFactory (FileDataStoreFactory. (File. tokens-directory-path)))
(setAccessType "offline")
(build))
Here is the relevant import:
(:import [com.google.api.client.googleapis.auth.oauth2 GoogleAuthorizationCodeFlow GoogleClientSecrets])
This is the error I'm getting:
1. Caused by java.lang.IllegalArgumentException
Unable to resolve classname: GoogleAuthorizationCodeFlow$Builder
I haven't done much Java interop before, so I expect I'm doing something silly.
This is the documentation for the GoogleAuthorizationCodeFlow
class: https://googleapis.dev/java/google-api-client/latest/.
Does anyone have any ideas or recommendations?@soxley Pretty sure you'll need to import GoogleAuthorizationCodeFlow$Builder
as well.
(off the top of my head)
(and I assume you have the library on your classpath, as part of your dependencies?)