Skip to content

Commit

Permalink
backport fix for pruning check
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Kuo (Danswer) committed Feb 6, 2025
1 parent d7d3369 commit d1c9780
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def validate_permission_sync_fence(
f"tasks_scanned={tasks_scanned} tasks_not_in_celery={tasks_not_in_celery}"
)

# we're only active if tasks_scanned > 0 and tasks_not_in_celery == 0
# we're active if there are still tasks to run and those tasks all exist in celery
if tasks_scanned > 0 and tasks_not_in_celery == 0:
redis_connector.permissions.set_active()
return
Expand Down
5 changes: 3 additions & 2 deletions backend/onyx/background/celery/tasks/pruning/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def validate_pruning_fence(

# look up every task in the current taskset in the celery queue
# every entry in the taskset should have an associated entry in the celery task queue
# because we get the celery tasks first, the entries in our own permissions taskset
# because we get the celery tasks first, the entries in our own pruning taskset
# should be roughly a subset of the tasks in celery

# this check isn't very exact, but should be sufficient over a period of time
Expand Down Expand Up @@ -655,7 +655,8 @@ def validate_pruning_fence(
f"tasks_scanned={tasks_scanned} tasks_not_in_celery={tasks_not_in_celery}"
)

if tasks_not_in_celery == 0:
# we're active if there are still tasks to run and those tasks all exist in celery
if tasks_scanned > 0 and tasks_not_in_celery == 0:
redis_connector.prune.set_active()
return

Expand Down

0 comments on commit d1c9780

Please sign in to comment.