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

Use mset instead of a loop over set for Stats#reset.

This commit is contained in:
Jonathan Hyman 2014-03-22 00:31:50 -04:00
parent b47bbbc2a6
commit ff9475096c

View file

@ -15,8 +15,13 @@ module Sidekiq
all = %w(failed processed)
stats = stats.empty? ? all : all & stats.flatten.compact.map(&:to_s)
mset_args = []
stats.each do |stat|
mset_args << "stat:#{stat}"
mset_args << 0
end
Sidekiq.redis do |conn|
stats.each { |stat| conn.set("stat:#{stat}", 0) }
conn.mset(*mset_args)
end
end