From 52fc66cb5ff19bf0def001ae50acc1b465a0b977 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 12 Nov 2026 23:34:46 +0100 Subject: fix(core): decouple task imports from app initialization Keep stable lazy task handles that register against the active Huey backend so modules can be imported before app creation and survive backend reinitialization. Separate package metadata and the shared blueprint from application startup to remove import-order dependencies and keep build-time version lookup lightweight. --- webmentions_ssg/tasks/notifications.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'webmentions_ssg/tasks/notifications.py') diff --git a/webmentions_ssg/tasks/notifications.py b/webmentions_ssg/tasks/notifications.py index fe12e93..fc1b475 100644 --- a/webmentions_ssg/tasks/notifications.py +++ b/webmentions_ssg/tasks/notifications.py @@ -14,9 +14,15 @@ from ..extensions import db, huey, mail from ..models import ReceivedStatus, ReceivedWebmention -@huey.lock_task("send-webmention-digest") def send_webmention_digest() -> None: """Send one digest of verified, previously unreported Webmentions.""" + # Resolve the lock against the current Huey backend, not the import-time one. + with huey.lock_task("send-webmention-digest"): + _send_webmention_digest() + + +def _send_webmention_digest() -> None: + """Do the work while the current backend's digest lock is held.""" recipient = current_app.config.get("NOTIFICATION_EMAIL") if not recipient: return -- cgit v1.3.1