Skip to content

Instantly share code, notes, and snippets.

@mlangenberg
Created October 24, 2012 12:15
Show Gist options
  • Save mlangenberg/3945750 to your computer and use it in GitHub Desktop.
Save mlangenberg/3945750 to your computer and use it in GitHub Desktop.
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
@rubytastic
Copy link

Sidekiq.configure_server do |config|
Sidekiq::Scheduled.send(:remove_const, "POLL_INTERVAL")
Sidekiq::Scheduled.const_set("POLL_INTERVAL", 1)
end

@mlangenberg
Copy link
Author

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

@mperham
Copy link

mperham commented Apr 25, 2013

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