dont add to the lookup table if it already exists

This commit is contained in:
Richard Kuo (Danswer)
2025-01-31 13:23:52 -08:00
parent 2676d40065
commit 69f16cc972
2 changed files with 4 additions and 1 deletions

View File

@@ -897,7 +897,9 @@ def monitor_vespa_sync(self: Task, tenant_id: str | None) -> bool | None:
# this is just a migration concern and should be unnecessary once # this is just a migration concern and should be unnecessary once
# lookup tables are rolled out # lookup tables are rolled out
for key_bytes in r_replica.scan_iter(count=SCAN_ITER_COUNT_DEFAULT): for key_bytes in r_replica.scan_iter(count=SCAN_ITER_COUNT_DEFAULT):
if is_fence(key_bytes): if is_fence(key_bytes) and not r.sismember(
OnyxRedisConstants.ACTIVE_FENCES, key_bytes
):
logger.warning(f"Adding {key_bytes} to the lookup table.") logger.warning(f"Adding {key_bytes} to the lookup table.")
r.sadd(OnyxRedisConstants.ACTIVE_FENCES, key_bytes) r.sadd(OnyxRedisConstants.ACTIVE_FENCES, key_bytes)

View File

@@ -114,6 +114,7 @@ class TenantRedis(redis.Redis):
"create_lock", "create_lock",
"startswith", "startswith",
"smembers", "smembers",
"sismember",
"sadd", "sadd",
"srem", "srem",
"scard", "scard",