From 969848938872d2ec47b0e9fb12b5894a74321ca4 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 15 Jun 2025 11:49:10 -0400 Subject: [PATCH] Reset Huey tasks from the CLI --- tubesync/sync/management/commands/reset-tasks.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tubesync/sync/management/commands/reset-tasks.py b/tubesync/sync/management/commands/reset-tasks.py index ae38a464..dc0029db 100644 --- a/tubesync/sync/management/commands/reset-tasks.py +++ b/tubesync/sync/management/commands/reset-tasks.py @@ -2,6 +2,8 @@ from django.core.management.base import BaseCommand, CommandError # noqa from django.db.transaction import atomic from django.utils.translation import gettext_lazy as _ from background_task.models import Task +from django_huey import DJANGO_HUEY +from common.huey import h_q_reset_tasks from common.logger import log from sync.models import Source from sync.tasks import index_source_task, check_source_directory_exists @@ -13,6 +15,8 @@ class Command(BaseCommand): def handle(self, *args, **options): log.info('Resettings all tasks...') + for queue_name in (DJANGO_HUEY or {}).get('queues', {}): + h_q_reset_tasks(queue_name) with atomic(durable=True): # Delete all tasks Task.objects.all().delete()