mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-23 15:38:08 +00:00
Fixes misunderstanding of how scan_iter yields keys
This commit is contained in:
parent
399d3e3ccc
commit
4bab19c126
1 changed files with 5 additions and 5 deletions
|
@ -53,11 +53,11 @@ def erase_keys(pattern, count=1000, dry_run=False):
|
|||
"""Delete all redis activity keys according to a provided regex pattern"""
|
||||
pipeline = r.pipeline()
|
||||
key_count = 0
|
||||
for keys in r.scan_iter(match=pattern, count=count):
|
||||
key_count += len(keys)
|
||||
if not dry_run:
|
||||
for key in keys:
|
||||
pipeline.delete(key)
|
||||
for key in r.scan_iter(match=pattern, count=count):
|
||||
key_count += 1
|
||||
if dry_run:
|
||||
continue
|
||||
pipeline.delete(key)
|
||||
if not dry_run:
|
||||
pipeline.execute()
|
||||
return key_count
|
||||
|
|
Loading…
Reference in a new issue