This gem provides a schedule plugin for delayed_job. The delayed_job worker will check after each loop for schedule tasks to do.
-
uses less memory than multiple workers for delayed_job and a scheduler (a.e. clockwork)
-
you can only use time ranges
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