Skip to content

Commit

Permalink
fix: disconnect before forking
Browse files Browse the repository at this point in the history
  • Loading branch information
spyderdfx committed Jun 7, 2016
1 parent 69866a2 commit 2bc67b8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/resque/integration/tasks/hooks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ namespace :resque do

Resque.before_fork do
Resque.redis.client.disconnect

ActiveRecord::Base.connection_handler.clear_all_connections!
end

Resque.after_fork do |job|
$0 = "resque-#{Resque::Version}: Processing #{job.queue}/#{job.payload['class']} since #{Time.now.to_s(:db)}"

if ActiveRecord::VERSION::MAJOR >= 4
ActiveRecord::Base.clear_active_connections!
else
ActiveRecord::Base.verify_active_connections!
end
ActiveRecord::Base.establish_connection

Resque.redis.client.connect
end
Expand Down

0 comments on commit 2bc67b8

Please sign in to comment.