Skip to content

Instantly share code, notes, and snippets.

@sushant12
Created December 13, 2017 10:40
Show Gist options
  • Save sushant12/4546471d79608f6504c3f932ef0d2224 to your computer and use it in GitHub Desktop.
Save sushant12/4546471d79608f6504c3f932ef0d2224 to your computer and use it in GitHub Desktop.
require 'resque/tasks'
require 'resque/scheduler/tasks'
task "resque:setup" => :environment do
Resque.before_fork = Proc.new do |job|
ActiveRecord::Base.connection.disconnect!
end
Resque.after_fork = Proc.new do |job|
ActiveRecord::Base.establish_connection
end
Resque::Scheduler.dynamic = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment