aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/consumer.py
diff options
context:
space:
mode:
authorDennis Fink2026-08-15 20:54:53 +0200
committerDennis Fink2026-08-15 20:54:53 +0200
commite0f65d7ff582b32f1c7b5508bba8cda807aaae5f (patch)
tree6693b9fc259bf642e0392b4d8920fbca7ffd6dda /webmentions_ssg/tasks/consumer.py
parentb3e12b975064f0873bdb4d2834cae75925387d6b (diff)
downloadwebmentions-ssg-e0f65d7ff582b32f1c7b5508bba8cda807aaae5f.tar.gz
webmentions-ssg-e0f65d7ff582b32f1c7b5508bba8cda807aaae5f.zip
feat(sender): add outgoing Webmention pipeline
Scan generated h-entry documents for Webmention targets and track source revisions and delivery state in the database. Discover target endpoints, send Webmentions asynchronously, and reconcile updated, removed, restored, and deleted sources across scans. Add authenticated views for inspecting sent Webmentions and make the scanner schedule configurable.
Diffstat (limited to 'webmentions_ssg/tasks/consumer.py')
-rw-r--r--webmentions_ssg/tasks/consumer.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/webmentions_ssg/tasks/consumer.py b/webmentions_ssg/tasks/consumer.py
index 5b85d0e..e53fce5 100644
--- a/webmentions_ssg/tasks/consumer.py
+++ b/webmentions_ssg/tasks/consumer.py
@@ -1,8 +1,19 @@
+from huey import Huey, crontab
+
from .. import HUEY, create_app
-app = create_app()
-# Import the tasks so they are registered with the initialized Huey instance.
-from . import receiver # noqa: E402, F401
+def create_consumer() -> Huey:
+ app = create_app()
+
+ from . import receiver, scanner, sender # noqa: E402, F401
+
+ schedule = crontab(
+ *app.config["WEBMENTIONS_SSG_SCANNER_SCHEDULE"].split(), strict=True
+ )
+ HUEY.periodic_task(schedule)(scanner.scan_sources)
+
+ return HUEY.huey
+
-huey = HUEY.huey
+huey = create_consumer()