diff --git a/config/initializers/4_resque.rb b/config/initializers/4_resque.rb index 419dbe06061..03c2b785fae 100644 --- a/config/initializers/4_resque.rb +++ b/config/initializers/4_resque.rb @@ -27,3 +27,5 @@ Resque::Server.use Authentication # Mailer Resque::Mailer.excluded_environments = [] + +Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index 0825324a424..36e461da660 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -1,9 +1,7 @@ require 'resque/tasks' task "resque:setup" => :environment do - Resque.after_fork do - Resque.redis.client.reconnect - end + Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } end desc "Alias for resque:work (To run workers on Heroku)"