Created
April 28, 2014 04:03
-
-
Save evadne/11361493 to your computer and use it in GitHub Desktop.
Starter Sidekiq Configuration
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/sidekiq.rb | |
require 'sidekiq' | |
Sidekiq.configure_client do |config| | |
config.redis = { | |
:url => ENV['SIDEKIQ_REDIS_URI'], | |
:namespace => ENV['SIDEKIQ_NAMESPACE'], | |
:size => ENV['SIDEKIQ_CLIENT_SIZE'] || 5 | |
} | |
end | |
Sidekiq.configure_server do |config| | |
config.redis = { | |
:url => ENV['SIDEKIQ_REDIS_URI'], | |
:namespace => ENV['SIDEKIQ_NAMESPACE'] | |
} | |
Rails.application.config.after_initialize do | |
ActiveRecord::Base.connection_pool.disconnect! | |
ActiveSupport.on_load(:active_record) do | |
if Rails.application.config.database_configuration | |
config = Rails.application.config.database_configuration[Rails.env] | |
config['checkout_timeout'] = ENV['DB_CHECKOUT_TIMEOUT'] || 30 | |
config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds | |
config['pool'] = ENV['DB_POOL'] || 5 | |
ActiveRecord::Base.establish_connection(config) | |
end | |
end | |
end | |
end |
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/sidekiq.yml | |
:concurrency: 33 | |
:queues: | |
- immediate | |
- often | |
- default | |
- seldom | |
- low |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment