mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Create a timeout that happens before cleanup (#5438)
* Create a timeout that happens before cleanup * Remove unnecessary code * Move a redis call into the method that is running redis: * Add timelock to beginning of cleanup
This commit is contained in:
parent
cc61161433
commit
dcd6d32c35
2 changed files with 2 additions and 0 deletions
|
@ -887,6 +887,7 @@ module Sidekiq
|
|||
# :nodoc:
|
||||
# @api private
|
||||
def cleanup
|
||||
return 0 unless Sidekiq.redis { |conn| conn.set("process_cleanup", "1", nx: true, ex: 60) }
|
||||
count = 0
|
||||
Sidekiq.redis do |conn|
|
||||
procs = conn.sscan_each("processes").to_a.sort
|
||||
|
|
|
@ -664,6 +664,7 @@ describe "API" do
|
|||
Sidekiq.redis do |conn|
|
||||
conn.sadd("processes", "bar:987")
|
||||
conn.sadd("processes", "bar:986")
|
||||
conn.del("process_cleanup")
|
||||
end
|
||||
|
||||
ps = Sidekiq::ProcessSet.new
|
||||
|
|
Loading…
Add table
Reference in a new issue