Skip to content

Instantly share code, notes, and snippets.

@gbuesing
Last active Oct 28, 2020
Embed
What would you like to do?
ActiveJob with resque-scheduler on Heroku
# for ActiveJobs
TestJob.set(wait: 10.minutes).perform_later
# for ActionMailer jobs
TestMailer.hello().deliver_later(wait: 10.minutes)
gem 'resque-scheduler'
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
# 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