Skip to content

Commit

Permalink
fix: Always expect a list from srandmember (valkey vs. kvrocks)
Browse files Browse the repository at this point in the history
More details: apache/kvrocks#2610
  • Loading branch information
Rafiot committed Oct 18, 2024
1 parent 9bc29ee commit 798c5b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lookyloo/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ def get_hash_uuids(self, body_hash: str) -> tuple[str, str] | None:
if capture_uuids := self.redis.zrevrange(f'body_hashes|{body_hash}|captures', 0, 0, withscores=False):
capture_uuid = capture_uuids[0]
internal_index = f'capture_indexes|{capture_uuid}'
if urlnode_uuid := self.redis.srandmember(f'{internal_index}|body_hashes|{body_hash}'):
return str(capture_uuid), str(urlnode_uuid)
urlnode_uuid: list[bytes | float | int | str]
if urlnode_uuid := self.redis.srandmember(f'{internal_index}|body_hashes|{body_hash}', 1):
return str(capture_uuid), str(urlnode_uuid[0])
return None

def get_captures_body_hash(self, body_hash: str, most_recent_capture: datetime | None = None,
Expand Down

0 comments on commit 798c5b5

Please sign in to comment.