From 798c5b5699f20df157f8f534a85d074e2a2c0634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 18 Oct 2024 21:22:07 +0200 Subject: [PATCH] fix: Always expect a list from srandmember (valkey vs. kvrocks) More details: https://github.com/apache/kvrocks/issues/2610 --- lookyloo/indexing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lookyloo/indexing.py b/lookyloo/indexing.py index c0ea4d4e..e5194f02 100644 --- a/lookyloo/indexing.py +++ b/lookyloo/indexing.py @@ -320,8 +320,9 @@ class Indexing(): 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,