diff --git a/backend/onyx/background/celery/tasks/vespa/tasks.py b/backend/onyx/background/celery/tasks/vespa/tasks.py index 05bd30298805..27f1b8b9c1d5 100644 --- a/backend/onyx/background/celery/tasks/vespa/tasks.py +++ b/backend/onyx/background/celery/tasks/vespa/tasks.py @@ -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 # lookup tables are rolled out 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.") r.sadd(OnyxRedisConstants.ACTIVE_FENCES, key_bytes) diff --git a/backend/onyx/redis/redis_pool.py b/backend/onyx/redis/redis_pool.py index 07fae38c5dc8..dd2111178d22 100644 --- a/backend/onyx/redis/redis_pool.py +++ b/backend/onyx/redis/redis_pool.py @@ -114,6 +114,7 @@ class TenantRedis(redis.Redis): "create_lock", "startswith", "smembers", + "sismember", "sadd", "srem", "scard",