Skip to content

Commit a7d8a01

Browse files
authored
Merge pull request #1 from dccunha/dc/fix/using_scan_at_cleanup
Using SCAN instead of KEYS at remove_queue
2 parents 3636a72 + 0b64d02 commit a7d8a01

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/resque/unique_in_queue/queue.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ def destroy(queue, klass, *args)
6464
end
6565

6666
def cleanup(queue)
67-
keys = redis.keys("#{Resque::UniqueInQueue.configuration&.unique_in_queue_key_base}:queue:#{queue}:job:*")
68-
redis.del(*keys) if keys.any?
67+
pattern = "#{Resque::UniqueInQueue.configuration&.unique_in_queue_key_base}:queue:#{queue}:job:*"
68+
keys = redis.scan_each(match: pattern, count: 1_000_000).to_a
69+
redis.del(keys) if keys.any?
6970
end
7071

7172
private

0 commit comments

Comments
 (0)