diff --git a/lib/resque/unique_in_queue/queue.rb b/lib/resque/unique_in_queue/queue.rb index baf2353..8f6b48c 100644 --- a/lib/resque/unique_in_queue/queue.rb +++ b/lib/resque/unique_in_queue/queue.rb @@ -64,8 +64,9 @@ def destroy(queue, klass, *args) end def cleanup(queue) - keys = redis.keys("#{Resque::UniqueInQueue.configuration&.unique_in_queue_key_base}:queue:#{queue}:job:*") - redis.del(*keys) if keys.any? + pattern = "#{Resque::UniqueInQueue.configuration&.unique_in_queue_key_base}:queue:#{queue}:job:*" + keys = redis.scan_each(match: pattern, count: 1_000_000).to_a + redis.del(keys) if keys.any? end private