1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Implement labels as a set, not array

This commit is contained in:
Mike Perham 2022-08-31 10:58:24 -07:00
parent 1b83a15278
commit a6ba349184
No known key found for this signature in database
3 changed files with 4 additions and 3 deletions

View file

@ -944,7 +944,7 @@ module Sidekiq
end end
def labels def labels
Array(self["labels"]) self["labels"].to_a
end end
def [](key) def [](key)

View file

@ -1,5 +1,6 @@
require "forwardable" require "forwardable"
require "set"
require "sidekiq/redis_connection" require "sidekiq/redis_connection"
module Sidekiq module Sidekiq
@ -8,7 +9,7 @@ module Sidekiq
extend Forwardable extend Forwardable
DEFAULTS = { DEFAULTS = {
labels: [], labels: Set.new,
require: ".", require: ".",
environment: nil, environment: nil,
concurrency: 10, concurrency: 10,

View file

@ -241,7 +241,7 @@ module Sidekiq
"tag" => @config[:tag] || "", "tag" => @config[:tag] || "",
"concurrency" => @config.capsules.map { |cap| cap.concurrency }.sum, "concurrency" => @config.capsules.map { |cap| cap.concurrency }.sum,
"queues" => @config.capsules.map { |cap| cap.queues }.flatten.uniq, "queues" => @config.capsules.map { |cap| cap.queues }.flatten.uniq,
"labels" => @config[:labels], "labels" => @config[:labels].to_a,
"identity" => identity "identity" => identity
} }
end end