aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks
diff options
context:
space:
mode:
authorDennis Fink2026-11-13 21:05:00 +0100
committerDennis Fink2026-11-13 21:05:00 +0100
commit78ecd8bc227bdcbbd0e45eea025f7223252ed0da (patch)
tree8a145182d835349f93aee9108155c3a0d3c62b9a /webmentions_ssg/tasks
parentca71bf1f30e118dd5bade3cff817d5bbd09f680a (diff)
downloadwebmentions-ssg-78ecd8bc227bdcbbd0e45eea025f7223252ed0da.tar.gz
webmentions-ssg-78ecd8bc227bdcbbd0e45eea025f7223252ed0da.zip
refactor(sender): rename locked task helpers
Rename the non-Huey scanner and sender helpers to `_scan_locked` and `_send_locked` so their names reflect that they run only while holding task locks.
Diffstat (limited to 'webmentions_ssg/tasks')
-rw-r--r--webmentions_ssg/tasks/scanner.py4
-rw-r--r--webmentions_ssg/tasks/sender.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py
index 1db52a5..5ee2d9e 100644
--- a/webmentions_ssg/tasks/scanner.py
+++ b/webmentions_ssg/tasks/scanner.py
@@ -110,10 +110,10 @@ def scan_sources() -> None:
"""
# Manual and periodic scans must contend for the current backend's lock.
with huey.lock_task("scan-webmention-sources"):
- scan_sources_task()
+ _scan_locked()
-def scan_sources_task() -> None:
+def _scan_locked() -> None:
"""Scan the sources while the caller holds the shared scan lock."""
directory = current_app.config.get("SOURCE_DIRECTORY")
diff --git a/webmentions_ssg/tasks/sender.py b/webmentions_ssg/tasks/sender.py
index 804b6f6..4f994d4 100644
--- a/webmentions_ssg/tasks/sender.py
+++ b/webmentions_ssg/tasks/sender.py
@@ -69,14 +69,14 @@ def send_webmention(webmention_uuid: uuid.UUID) -> None:
# The pending/retry checks must happen *under* this lock.
try:
with huey.lock_task(f"send-webmention-{webmention_uuid}"):
- send_webmention_task(webmention_uuid)
+ _send_locked(webmention_uuid)
except TaskLockedException:
# Another worker is already sending this Webmention. The active worker
# owns its result; a later scan will requeue it if it remains pending.
return
-def send_webmention_task(webmention_uuid: uuid.UUID) -> None:
+def _send_locked(webmention_uuid: uuid.UUID) -> None:
"""Process a Webmention while holding its per-UUID task lock."""
webmention = db.session.get(SentWebmention, webmention_uuid)