The rescue-scheduler
gem installation says to create a separate Rake task for scheduling:
https://github.com/resque/resque-scheduler#rake-integration
namespace :resque do
task :setup_schedule => :setup do
...
task :scheduler => :setup_schedule
$ rake resque:scheduler
However my Heroku Procfile
already has a worker process to run Resque:
resque: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=7 QUEUE=* bundle exec rake resque:work COUNT=1
I don't want to create yet another worker process just to run scheduled jobs. This old blog posts says you can set it up without using Rake tasks.
https://www.perfectline.co/blog/2011/07/cron-tasks-for-your-rails-application-with-resque-2/
How do you schedule Resque jobs on Heroku without use 2 worker dynos?
I tried to add multiple dependencies but it gave me a circular dependency error.
namespace :resque do
task :setup => [:environment, :scheduler]
Console
>env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=7 QUEUE=* bundle exec rake resque:work COUNT=1
rake aborted!
Circular dependency detected: TOP => resque:work => resque:preload => resque:setup => resque:scheduler => resque:setup_schedule => resque:setup
Tasks: TOP => resque:work => resque:preload => resque:setup => resque:scheduler => resque:setup_schedule
This works https://grosser.it/2012/04/14/resque-scheduler-on-heroku-without-extra-workers/
And to launch it