Allow multiple host when restricting Sidekiq queues.

This commit is contained in:
Guo Xiang Tan 2017-06-19 14:45:51 +09:00
parent be44e4b730
commit 7ea288140d
2 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ if Sidekiq.server?
Rails.application.config.after_initialize do
scheduler_hostname = ENV["UNICORN_SCHEDULER_HOSTNAME"]
if !scheduler_hostname || scheduler_hostname == `hostname`.strip
if !scheduler_hostname || scheduler_hostname.split(',').include?(`hostname`.strip)
require 'scheduler/scheduler'
manager = Scheduler::Manager.new
Scheduler::Manager.discover_schedules.each do |schedule|

View File

@ -37,7 +37,7 @@ class Demon::Sidekiq < Demon::Base
[['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
if !custom_queue_hostname || custom_queue_hostname.split(',').include?(`hostname`.strip)
options << "-q"
options << "#{queue_name},#{weight}"
end