mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-17 10:36:35 +00:00
Reset Huey tasks from the CLI
This commit is contained in:
parent
98f5d45391
commit
9698489388
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user