Fork me on GitHub
#biff
<
2023-09-23
>
john2x09:09:03

Do Scheduled Tasks run in the same JVM process as the server? how do they work when running multiple instances of the app?

Martynas Maciulevičius12:09:38

Same process. Chime works in-process. You'll have to do something else to fix it.

Jacob O'Bryant15:09:21

yep. same for the in-memory queues. both are mostly useful on a single machine, though could potentially be used as building blocks for something that works with multiple machines.

Jacob O'Bryant16:09:59

the easiest way would be to configure the machines so that only one of them executes cron jobs. when you run server-setup.sh , you can specify a different value for BIFF_ENV (default is prod), and then that machine can have its own section in config.edn. for something more robust, I would probably set up a job queue e.g. with redis and then have the scheduled task idempotently put a job on the queue.

Martynas Maciulevičius23:09:14

If you want to move to multi-machine setup then you need something like Zookeeper and this gets hairy quite fast. Then you'll be doing master election and all of this stuff....