diff --git a/lib/umbrellio_utils/jobs.rb b/lib/umbrellio_utils/jobs.rb index 86f8c2c..80f9ec6 100644 --- a/lib/umbrellio_utils/jobs.rb +++ b/lib/umbrellio_utils/jobs.rb @@ -67,7 +67,8 @@ def capsules_for(worker, max_concurrency) weight_coef = capsule.weight / total_weight.to_f concurrency = (max_concurrency * weight_coef).to_i concurrency = 1 unless concurrency > 1 - queues = self.queues.select { |x| x.capsule == capsule.name }.map { |x| [x.name, x.weight] } + queues = + self.queues.select { |x| x.capsule == capsule.name }.map { |x| [x.name.to_s, x.weight] } Entry.new(capsule.name, queues, concurrency) end diff --git a/lib/umbrellio_utils/version.rb b/lib/umbrellio_utils/version.rb index 70633d7..7c8b1df 100644 --- a/lib/umbrellio_utils/version.rb +++ b/lib/umbrellio_utils/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module UmbrellioUtils - VERSION = "1.5.0" + VERSION = "1.5.1" end diff --git a/spec/umbrellio_utils/jobs_spec.rb b/spec/umbrellio_utils/jobs_spec.rb index c30ea87..5c45aef 100644 --- a/spec/umbrellio_utils/jobs_spec.rb +++ b/spec/umbrellio_utils/jobs_spec.rb @@ -36,9 +36,9 @@ specify do expect(result).to eq( [ - UmbrellioUtils::Jobs::Entry.new(:default, [[:q3, 10], [:q4, 1]], 1), - UmbrellioUtils::Jobs::Entry.new(:cap1, [[:q1, 1]], 3), - UmbrellioUtils::Jobs::Entry.new(:cap2, [[:q2, 5]], 6), + UmbrellioUtils::Jobs::Entry.new(:default, [["q3", 10], ["q4", 1]], 1), + UmbrellioUtils::Jobs::Entry.new(:cap1, [["q1", 1]], 3), + UmbrellioUtils::Jobs::Entry.new(:cap2, [["q2", 5]], 6), ], ) end @@ -49,7 +49,7 @@ specify do expect(result).to eq( [ - UmbrellioUtils::Jobs::Entry.new(:cap3, [[:q5, 1]], 10), + UmbrellioUtils::Jobs::Entry.new(:cap3, [["q5", 1]], 10), ], ) end @@ -80,13 +80,13 @@ specify do jobs.configure_capsules!(config, priority_level: "default", max_concurrency: 10) - expect(capsule_default.queues).to eq([[:q3, 10], [:q4, 1]]) + expect(capsule_default.queues).to eq([["q3", 10], ["q4", 1]]) expect(capsule_default.concurrency).to eq(1) - expect(capsule_cap1.queues).to eq([[:q1, 1]]) + expect(capsule_cap1.queues).to eq([["q1", 1]]) expect(capsule_cap1.concurrency).to eq(3) - expect(capsule_cap2.queues).to eq([[:q2, 5]]) + expect(capsule_cap2.queues).to eq([["q2", 5]]) expect(capsule_cap2.concurrency).to eq(6) end @@ -94,7 +94,7 @@ specify do jobs.configure_capsules!(config, priority_level: "w1", max_concurrency: 10) - expect(capsule_default.queues).to eq([[:q5, 1]]) + expect(capsule_default.queues).to eq([["q5", 1]]) expect(capsule_default.concurrency).to eq(10) expect(capsule_cap1.queues).to eq(nil)