From 4cffc94aecc32a1519dce9991ab8c5082988b3d4 Mon Sep 17 00:00:00 2001 From: tcely Date: Fri, 6 Jun 2025 04:44:30 -0400 Subject: [PATCH] Retry the task when the queue worker is stopped --- tubesync/sync/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index e0d7cd50..11ec02a4 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -361,8 +361,11 @@ def migrate_to_metadata(media_id): @background(schedule=dict(priority=0, run_at=0), queue=Val(TaskQueue.NET), remove_existing_tasks=False) def wait_for_database_queue(): + worker_down_path = Path('/run/service/tubesync-db-worker/down') while Task.objects.unlocked(timezone.now()).filter(queue=Val(TaskQueue.DB)).count() > 0: time.sleep(5) + if worker_down_path.exists() and worker_down_path.is_file(): + raise Exception(_('queue worker stopped')) @background(schedule=dict(priority=20, run_at=30), queue=Val(TaskQueue.NET), remove_existing_tasks=True)