Search code examples
ruby-on-railsrubyscheduled-tasksbackgroundrb

How to prevent backgroundrb from starting multiple copies of the same task?


Say, I have a worker that's set up to run every 15 minutes using the cron scheduling feature of backgroundrb. Then, say, if a single instance of the worker takes longer than 15 minutes to run, I don't want a second worker to be started in paraller by backgroundrb. How do I achieve that?


Solution

  • Okay, I guess I'll answer this one myself. The trick is to not specify reload_on_schedule true in your worker.