Skip to content

Commit

Permalink
Fix race condition in search_indexing task (#2136)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen authored Oct 24, 2024
1 parent a1d5c61 commit 6e1c906
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/palace/manager/celery/tasks/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ def search_indexing(task: Task, batch_size: int = 500) -> None:
if len(works) > 0:
index_works.delay(works=works)

if len(works) == batch_size:
# This task is complete, but there are more works waiting to be indexed. Requeue ourselves
# to process the next batch.
raise task.replace(search_indexing.s(batch_size=batch_size))
if len(works) == batch_size:
# This task is complete, but there are more works waiting to be indexed. Requeue ourselves
# to process the next batch.
raise task.replace(search_indexing.s(batch_size=batch_size))

task.log.info(f"Finished queuing indexing tasks.")
return
task.log.info(f"Finished queuing indexing tasks.")
return


@shared_task(queue=QueueNames.default, bind=True, max_retries=4)
Expand Down

0 comments on commit 6e1c906

Please sign in to comment.