diff --git a/services/tracking/cross_camera_reid.py b/services/tracking/cross_camera_reid.py index 28b7c2b..a071486 100644 --- a/services/tracking/cross_camera_reid.py +++ b/services/tracking/cross_camera_reid.py @@ -228,7 +228,13 @@ def _fetch_candidates( """Return all live embedding records that belong to other cameras.""" pattern = "embed:*" # KEYS is fine for small deployments; use SCAN for production scale - all_keys: list[bytes] = self._r.keys(pattern) + all_keys = [] + cursor = 0 + while True: + cursor, batch = self._r.scan(cursor, match=pattern, count=100) + all_keys.extend(batch) + if cursor == 0: + break records: list[EmbeddingRecord] = [] for raw_key in all_keys: