From f4f49d407e2387e1203129d3027f35e159645dea Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 7 Jun 2026 00:10:03 -0400 Subject: [PATCH] fix(tags): move _NORMALIZE_CHUNK_SECONDS above the decorator (syntax error) The constant + comment landed BETWEEN @celery.task(...) and the function def, which is a syntax error that broke the whole tasks.admin import (cascaded to lint E999 + every backend/integration test). Move it above the decorator. Co-Authored-By: Claude Opus 4.8 (1M context) --- backend/app/tasks/admin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/app/tasks/admin.py b/backend/app/tasks/admin.py index f9dafd4..9a65f1e 100644 --- a/backend/app/tasks/admin.py +++ b/backend/app/tasks/admin.py @@ -75,13 +75,6 @@ def reextract_archive_attachments_task(self) -> dict: ) -@celery.task( - name="backend.app.tasks.admin.normalize_tags_task", - bind=True, - autoretry_for=(OperationalError, DBAPIError), - retry_backoff=15, retry_backoff_max=180, max_retries=1, - soft_time_limit=1800, time_limit=2400, # 30 min / 40 min -) # Time-box one chunk well under the soft limit so a large back-catalog (the # first run recases the whole booru vocabulary) can't run the task into the # Celery time limit — it timed out at 40 min, operator-flagged 2026-06-07. The @@ -91,6 +84,13 @@ def reextract_archive_attachments_task(self) -> dict: _NORMALIZE_CHUNK_SECONDS = 600 +@celery.task( + name="backend.app.tasks.admin.normalize_tags_task", + bind=True, + autoretry_for=(OperationalError, DBAPIError), + retry_backoff=15, retry_backoff_max=180, max_retries=1, + soft_time_limit=1800, time_limit=2400, # 30 min / 40 min +) def normalize_tags_task(self) -> dict: """Wraps tag_service.normalize_existing_tags (#714): Title-Case the back-catalog and merge case/whitespace-variant duplicate tags via the