Created
July 24, 2012 13:28
-
-
Save krasio/3169917 to your computer and use it in GitHub Desktop.
config/initializers/redis_on_passenger.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/redis_on_passenger.rb | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
# We're in smart spawning mode. | |
if forked | |
# Re-establish redis connection | |
# disconnect | |
Resque.redis.client.disconnect | |
# connect | |
resque_config = YAML.load_file(Rails.root.to_s + '/config/resque.yml')[Rails.env] | |
Resque.redis = resque_config | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment