Skip to content

Instantly share code, notes, and snippets.

@shamil614
Created July 3, 2013 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamil614/5919553 to your computer and use it in GitHub Desktop.
Save shamil614/5919553 to your computer and use it in GitHub Desktop.
if Rails.env.staging? || Rails.env.production?
begin
redis_config = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env]
Sidekiq.configure_server do |config|
config.redis = { :url => "redis://#{redis_config['host']}:#{redis_config['port']}", :namespace => 'nin' }
end
# When in Unicorn, this block needs to go in unicorn's `after_fork` callback:
Sidekiq.configure_client do |config|
config.redis = { :url => "redis://#{redis_config['host']}:#{redis_config['port']}", :namespace => 'nin' }
end
rescue
Rails.logger.error "Unable to start sidekiq."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment