From c68540e9c94eed7dbe7683e47450b026c9ee3bb6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 26 Dec 2012 19:56:56 +0200 Subject: [PATCH] Fix resque for postgres --- config/initializers/4_resque.rb | 2 ++ lib/tasks/resque.rake | 1 + 2 files changed, 3 insertions(+) diff --git a/config/initializers/4_resque.rb b/config/initializers/4_resque.rb index 419dbe06..03c2b785 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 0825324a..bf031403 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -4,6 +4,7 @@ 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)"