delayed_job_schedule¶ ↑
This gem provides a schedule plugin for delayed_job. The delayed_job worker will check after each loop for schedule tasks to do.
Pro¶ ↑
-
uses less memory than multiple workers for delayed_job and a scheduler (a.e. clockwork)
Contra¶ ↑
-
you can only use time ranges
Install¶ ↑
Add delayed_job_schedule to your Gemfile:
gem 'delayed_job_schedule', git: 'https://github.com/lichtbit/delayed_job_schedule.git'
Use it in your initializer:
Delayed::Schedule.every(1.minutes) { Cache.clean_up! } Delayed::Schedule.every(5.minutes) { Mailer.send_status } Delayed::Schedule.every(3.hours) { Database.reimport } Delayed::Schedule.worker_select = -> (worker) do worker.queues == [] || worker.queues == ['default'] end