diff --git a/lib/verdict/storage/redis_storage.rb b/lib/verdict/storage/redis_storage.rb index c540020..7af8ba1 100644 --- a/lib/verdict/storage/redis_storage.rb +++ b/lib/verdict/storage/redis_storage.rb @@ -67,15 +67,17 @@ def scope_key(scope) end def scrub(scope, cursor: 0) - cursor, results = redis.with do |conn| - conn.hscan(scope_key(scope), cursor, count: PAGE_SIZE) - end + loop do + cursor, results = redis.with do |conn| + conn.hscan(scope_key(scope), cursor, count: PAGE_SIZE) + end - results.map(&:first).each do |key| - remove(scope, key) - end + results.map(&:first).each do |key| + remove(scope, key) + end - scrub(scope, cursor: cursor) unless cursor.to_i.zero? + break if cursor.to_i.zero? + end end end end