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:
parent
1b83a15278
commit
a6ba349184
3 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue