Last active
December 5, 2024 16:31
-
-
Save gbuesing/b07e7615c18bddd31a95e285a86d504b to your computer and use it in GitHub Desktop.
ActiveJob with resque-scheduler on Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for ActiveJobs | |
TestJob.set(wait: 10.minutes).perform_later | |
# for ActionMailer jobs | |
TestMailer.hello().deliver_later(wait: 10.minutes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'resque-scheduler' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: bundle exec passenger start -p $PORT --max-pool-size 3 | |
worker: env TERM_CHILD=1 QUEUE=* bundle exec rake resque:work | |
scheduler: bundle exec rake resque:scheduler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/resque.rake | |
require "resque/tasks" | |
require 'resque/scheduler/tasks' | |
namespace :resque do | |
task :setup => :environment | |
task :setup_schedule => :setup do | |
require 'resque-scheduler' | |
end | |
task :scheduler => :setup_schedule | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment