1
0
Fork 0
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:
Sam 2022-07-19 14:11:06 -07:00 committed by GitHub
parent cc61161433
commit dcd6d32c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -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

View file

@ -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