Skip to content

Commit

Permalink
missed removed scan_iter, also remove other scan_iters and replace wi…
Browse files Browse the repository at this point in the history
…th sscan_iter of the lookup table
  • Loading branch information
Richard Kuo (Danswer) committed Feb 6, 2025
1 parent 2be59a4 commit ef07f50
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
15 changes: 0 additions & 15 deletions backend/onyx/background/celery/tasks/pruning/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
from onyx.redis.redis_connector_prune import RedisConnectorPrunePayload
from onyx.redis.redis_pool import get_redis_client
from onyx.redis.redis_pool import get_redis_replica_client
from onyx.redis.redis_pool import SCAN_ITER_COUNT_DEFAULT
from onyx.server.utils import make_short_id
from onyx.utils.logger import LoggerContextVars
from onyx.utils.logger import pruning_ctx
Expand Down Expand Up @@ -563,20 +562,6 @@ def validate_pruning_fences(

lock_beat.reacquire()

# validate all existing indexing jobs
for key_bytes in r.scan_iter(
RedisConnectorPrune.FENCE_PREFIX + "*",
count=SCAN_ITER_COUNT_DEFAULT,
):
lock_beat.reacquire()
validate_pruning_fence(
tenant_id,
key_bytes,
reserved_generator_tasks,
queued_upsert_tasks,
r,
r_celery,
)
return


Expand Down
3 changes: 2 additions & 1 deletion backend/onyx/redis/redis_connector_doc_perm_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def get_remaining(self) -> int:
def get_active_task_count(self) -> int:
"""Count of active permission sync tasks"""
count = 0
for _ in self.redis.scan_iter(
for _ in self.redis.sscan_iter(
OnyxRedisConstants.ACTIVE_FENCES,
RedisConnectorPermissionSync.FENCE_PREFIX + "*",
count=SCAN_ITER_COUNT_DEFAULT,
):
Expand Down
3 changes: 2 additions & 1 deletion backend/onyx/redis/redis_connector_ext_group_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def get_remaining(self) -> int:
def get_active_task_count(self) -> int:
"""Count of active external group syncing tasks"""
count = 0
for _ in self.redis.scan_iter(
for _ in self.redis.sscan_iter(
OnyxRedisConstants.ACTIVE_FENCES,
RedisConnectorExternalGroupSync.FENCE_PREFIX + "*",
count=SCAN_ITER_COUNT_DEFAULT,
):
Expand Down
6 changes: 4 additions & 2 deletions backend/onyx/redis/redis_connector_prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ def get_remaining(self) -> int:
def get_active_task_count(self) -> int:
"""Count of active pruning tasks"""
count = 0
for key in self.redis.scan_iter(
RedisConnectorPrune.FENCE_PREFIX + "*", count=SCAN_ITER_COUNT_DEFAULT
for _ in self.redis.sscan_iter(
OnyxRedisConstants.ACTIVE_FENCES,
RedisConnectorPrune.FENCE_PREFIX + "*",
count=SCAN_ITER_COUNT_DEFAULT,
):
count += 1
return count
Expand Down

0 comments on commit ef07f50

Please sign in to comment.