Created
          October 24, 2012 12:15 
        
      - 
      
- 
        Save mlangenberg/3945750 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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
    
  
  
    
  | redis_config = { :namespace => 'sidekiq', :url => YAML.load_file("#{Rails.root}/config/redis.yml")[Rails.env] } | |
| Sidekiq.configure_server do |config| | |
| config.redis = redis_config | |
| end | |
| Sidekiq.configure_client do |config| | |
| config.redis = redis_config | |
| end | 
Since we also use Passenger, look at this lolconf
redis_config = { namespace: 'sidekiq', url: YAML.load_file("#{Rails.root}/config/redis.yml")[Rails.env] }
Sidekiq.configure_server do |config|
  config.redis = redis_config
end
configure_client = -> do
  Sidekiq.configure_client do |config|
    config.redis = redis_config
  end
end
if defined?(PhusionPassenger)
  PhusionPassenger.on_event(:starting_worker_process) do |forked|
    configure_client.call if forked
  end
else
  configure_client.call
end
Note that both comments are now wrong.
poll interval can be configured directly:
Sidekiq.configure_server do |config|
  config.poll_interval = 1
end
and Passenger's starting_worker_process or Unicorn's after_fork is no longer necessary since Sidekiq 2.9.0.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Sidekiq.configure_server do |config|
Sidekiq::Scheduled.send(:remove_const, "POLL_INTERVAL")
Sidekiq::Scheduled.const_set("POLL_INTERVAL", 1)
end