Fix Resque "Internal Server Error" issue in pushion passenger forked environment

This commit is contained in:
Manson Wang 2014-02-13 17:28:12 +08:00
parent ee6dcf238f
commit 095157c0ae
1 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,11 @@
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
Resque.redis.client.disconnect
Resque.redis = Redis.new(:host => 'localhost', :port => 6379)
Resque.redis.namespace = Site.first.resque_namespace rescue APP_CONFIG['orbit']
else
# We're in conservative spawning mode. We don't need to do anything.
end
end
end