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

Pipeline leads to expiry race condition, fixes #2982

This commit is contained in:
Mike Perham 2016-05-23 10:19:59 -07:00
parent 77b05da266
commit 19581c4b57

View file

@ -80,7 +80,7 @@ module Sidekiq
workers_key = "#{key}:workers".freeze workers_key = "#{key}:workers".freeze
nowdate = Time.now.utc.strftime("%Y-%m-%d".freeze) nowdate = Time.now.utc.strftime("%Y-%m-%d".freeze)
Sidekiq.redis do |conn| Sidekiq.redis do |conn|
conn.pipelined do conn.multi do
conn.incrby("stat:processed".freeze, procd) conn.incrby("stat:processed".freeze, procd)
conn.incrby("stat:processed:#{nowdate}", procd) conn.incrby("stat:processed:#{nowdate}", procd)
conn.incrby("stat:failed".freeze, fails) conn.incrby("stat:failed".freeze, fails)
@ -95,7 +95,7 @@ module Sidekiq
fails = procd = 0 fails = procd = 0
_, _, _, msg = Sidekiq.redis do |conn| _, _, _, msg = Sidekiq.redis do |conn|
conn.pipelined do conn.multi do
conn.sadd('processes', key) conn.sadd('processes', key)
conn.hmset(key, 'info', json, 'busy', Processor::WORKER_STATE.size, 'beat', Time.now.to_f, 'quiet', @done) conn.hmset(key, 'info', json, 'busy', Processor::WORKER_STATE.size, 'beat', Time.now.to_f, 'quiet', @done)
conn.expire(key, 60) conn.expire(key, 60)