mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
Allow a sidekiq queue to be configured to only run on a certain hostname.
This commit is contained in:
parent
b755279cf0
commit
84490c4558
|
@ -31,8 +31,19 @@ class Demon::Sidekiq < Demon::Base
|
|||
# parent process is in charge of the file anyway.
|
||||
Sidekiq::Logging.logger = nil
|
||||
cli = Sidekiq::CLI.instance
|
||||
cli.parse(["-c", GlobalSetting.sidekiq_workers.to_s, "-q", "critical,4", "-q", "default,2", "-q", "low"])
|
||||
|
||||
options = ["-c", GlobalSetting.sidekiq_workers.to_s]
|
||||
|
||||
[['critical', 4], ['default', 2], ['low', 1]].each do |queue_name, weight|
|
||||
custom_queue_hostname = ENV["UNICORN_SIDEKIQ_#{queue_name.upcase}_QUEUE_HOSTNAME"]
|
||||
|
||||
if !custom_queue_hostname || custom_queue_hostname == `hostname`.strip
|
||||
options << "-q"
|
||||
options << "#{queue_name},#{weight}"
|
||||
end
|
||||
end
|
||||
|
||||
cli.parse(options)
|
||||
load Rails.root + "config/initializers/100-sidekiq.rb"
|
||||
cli.run
|
||||
rescue => e
|
||||
|
|
Loading…
Reference in New Issue
Block a user