Skip to content

Commit

Permalink
refactor: improved scan/remove
Browse files Browse the repository at this point in the history
  • Loading branch information
danellecline committed Nov 14, 2024
1 parent bd4861f commit 4eeadfe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions aipipeline/prediction/vss_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ def run_pipeline(argv=None):

logger.info(f"Removing hash {args.doc} from the VSS database...")

# Get all keys matching the pattern
keys = r.keys(args.doc)
# Find and delete keys matching the pattern
num_deleted = 0
for key in r.scan_iter(args.doc):
r.delete(key)
num_deleted += 1

# Delete the keys
if keys:
r.delete(*keys)

print(f"Deleted {len(keys)} keys.")
print(f"Deleted {num_deleted} keys.")


if __name__ == "__main__":
Expand Down

0 comments on commit 4eeadfe

Please sign in to comment.