This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-08
Channels
- # announcements (11)
- # babashka (13)
- # beginners (11)
- # biff (2)
- # calva (17)
- # cider (19)
- # clojure (60)
- # clojure-berlin (1)
- # clojure-dev (20)
- # clojure-europe (48)
- # clojure-nl (1)
- # clojure-norway (98)
- # clojure-spec (7)
- # clojure-uk (5)
- # core-typed (32)
- # cursive (13)
- # datomic (12)
- # dev-tooling (5)
- # emacs (7)
- # figwheel-main (2)
- # graalvm (4)
- # hyperfiddle (4)
- # introduce-yourself (1)
- # malli (14)
- # missionary (32)
- # off-topic (7)
- # overtone (4)
- # pedestal (10)
- # proletarian (4)
- # re-frame (8)
- # releases (11)
- # tools-build (1)
- # tools-deps (4)
- # xtdb (38)
New Proletarian user here as well. Thanks for the great library! I have some recurring jobs I want to run in a cluster so that exactly one node executes the job at any scheduled time. My current working hypothesis is to use a) Chime for scheduling, b) Proletarian for at-least-once + retries, c) custom table with timestamp (from Chime) + job-type + locking when enqueuing to get at-most-once behaviour. Does this sound sane? Have I missed some Proletarian functionality/pattern that supports clustered at-most-once out of the box? In case there's no existing way to do this, would it be wildly out of scope for Proletarian to support at-most-once behaviour by accepting an additional key when enqueuing a job (I could try my hand at creating a PR).
Hi @U06NME2EQ4U, thanks for using Proletarian! Like @U02HPS0397S says, Proletarian is "at-most-once" in the happy path - when no exceptions occur during processing of the job. If there is a failure it will get processed again, however. This is to provide the at least one guarantee that we absolutely want.
Out the box Proletarian can do "[...] exactly one node executes the job at any scheduled time". This is the bread and butter of Proletarian. But we have to consider failure and retries, too. A job might have done all there is to do (call a third party API, for example), yet fail just before Proletarian can commit its finished state to the database - then it will be retried (if configured to do so), and it's on you, the developer, to ensure that the effect of the job, when run again, is the same as if it was only run once. This is idempotency. (You might tolerate, in your business domain, that the effect happens twice or more. In that case you don't have to implement your own idempotency checks.)
Yes, idempotency checks are the key thing here, as every node in the cluster will try to schedule the same job and it should only be executed once per any scheduled time. I guess the specific exact requirements for idempotency vary so much between use cases that it probably makes sense to roll your own implementation. Thanks for taking the time to address this!