aboutsummaryrefslogtreecommitdiff
path: root/tests/tasks/test_consumer.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-30 20:13:42 +0100
committerDennis Fink2026-10-30 20:13:42 +0100
commit8fd569c6c0a39761f7ddda3c6e145d90534b4300 (patch)
treef92209df1918fd5c9ac27efe25463afaef2a1a5f /tests/tasks/test_consumer.py
parenta2992533873cb53acb052cdcd4288430b24af587 (diff)
downloadwebmentions-ssg-8fd569c6c0a39761f7ddda3c6e145d90534b4300.tar.gz
webmentions-ssg-8fd569c6c0a39761f7ddda3c6e145d90534b4300.zip
fix(receiver): recover stale Webmention verifications
Add a periodic recovery sweep for Webmentions left in received or verifying states after worker crashes, lost queue entries, or interrupted processing. Use atomic lease-style updates so stale workers cannot overwrite newer results, and index verification state for efficient recovery scans.
Diffstat (limited to 'tests/tasks/test_consumer.py')
-rw-r--r--tests/tasks/test_consumer.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/tasks/test_consumer.py b/tests/tasks/test_consumer.py
index 6b79e37..dd93331 100644
--- a/tests/tasks/test_consumer.py
+++ b/tests/tasks/test_consumer.py
@@ -13,13 +13,14 @@ from flask import Flask
from webmentions_ssg import HUEY
-def test_consumer_registers_scanner_and_digest(
+def test_consumer_registers_scanner_digest_and_verification_reaper(
app: Flask, monkeypatch: pytest.MonkeyPatch
) -> None:
import webmentions_ssg
app.config["SCANNER_SCHEDULE"] = "*/15 * * * *"
app.config["NOTIFICATION_SCHEDULE"] = "0 9 * * *"
+ app.config["VERIFICATION_REAPER_SCHEDULE"] = "*/3 * * * *"
registered_tasks: list[object] = []
@@ -35,11 +36,12 @@ def test_consumer_registers_scanner_and_digest(
monkeypatch.setattr(HUEY, "periodic_task", periodic_task)
consumer = importlib.import_module("webmentions_ssg.tasks.consumer")
- from webmentions_ssg.tasks import notifications, scanner
+ from webmentions_ssg.tasks import notifications, receiver, scanner
assert consumer.huey is HUEY.huey
- assert periodic_task.call_count == 2
+ assert periodic_task.call_count == 3
assert registered_tasks == [
scanner.scan_sources,
+ receiver.recover_stale_webmentions,
notifications.send_webmention_digest,
]