diff options
Diffstat (limited to 'webmentions_ssg/tasks/notifications.py')
| -rw-r--r-- | webmentions_ssg/tasks/notifications.py | 8 |
1 files changed, 7 insertions, 1 deletions
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 |
