Created
March 17, 2017 22:38
-
-
Save schovi/252f63366b4549d6e6a3b0170df8d836 to your computer and use it in GitHub Desktop.
Configure sidekiq via ENV variables
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
Sidekiq.configure_server do |config| | |
ENV["SIDEKIQ_NAMESPACE"] && config.options[:namespace] = ENV["SIDEKIQ_NAMESPACE"] | |
ENV["SIDEKIQ_CONCURRENCY"] && config.options[:concurrency] = ENV["SIDEKIQ_CONCURRENCY"].to_i | |
ENV["SIDEKIQ_VERBOSE"] && config.options[:verbose] = ENV["SIDEKIQ_VERBOSE"] === 'true' | |
ENV["SIDEKIQ_LOGFILE"] && config.options[:logfile] = ENV["SIDEKIQ_LOGFILE"] | |
ENV["SIDEKIQ_PIDFILE"] && config.options[:pidfile] = ENV["SIDEKIQ_PIDFILE"] | |
config.options[:strict] = true | |
if ENV["SIDEKIQ_QUEUES"] | |
queues = [] | |
ENV["SIDEKIQ_QUEUES"].split(/\s+/).each do |queue_weighted| | |
queue, count = queue_weighted.split(",") | |
count = count.to_i | |
if count > 0 | |
config.options[:strict] = false | |
end | |
[count, 1].max.times do | |
queues.push(queue) | |
end | |
end | |
config.options[:queues] = queues | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
queues should look like this: