diff options
| author | Dennis Fink | 2026-10-30 13:24:53 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-10-30 13:24:53 +0100 |
| commit | f6d96df2c3aecb51ca97426efddb101dce6350d7 (patch) | |
| tree | 2968f65a627fbfd15051277d07eaa321db0e3cc4 /webmentions_ssg/tasks/scanner.py | |
| parent | 2b59a3082000842d980f9e19931949dbe5011229 (diff) | |
| download | webmentions-ssg-f6d96df2c3aecb51ca97426efddb101dce6350d7.tar.gz webmentions-ssg-f6d96df2c3aecb51ca97426efddb101dce6350d7.zip | |
feat(sender): add persistent retry backoff
Persist retry state per source revision so temporary delivery failures
survive worker restarts and duplicate queued tasks cannot bypass the
retry schedule.
Use capped exponential backoff, stop after a configurable attempt limit,
and reset the retry budget when a source changes or an admin resends
manually.
Diffstat (limited to 'webmentions_ssg/tasks/scanner.py')
| -rw-r--r-- | webmentions_ssg/tasks/scanner.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py index 7e163f7..03f4b8d 100644 --- a/webmentions_ssg/tasks/scanner.py +++ b/webmentions_ssg/tasks/scanner.py @@ -385,6 +385,8 @@ def update_source( for webmention in existing.values(): webmention.active = webmention.target in scanned.targets webmention.desired_revision = source.revision + webmention.attempt_count = 0 + webmention.next_retry_at = None if not webmention.active and webmention.sent_revision is None: webmention.processed_revision = source.revision @@ -522,6 +524,8 @@ def scan_sources() -> None: for webmention in source.sent_webmentions: webmention.active = False webmention.desired_revision = source.revision + webmention.attempt_count = 0 + webmention.next_retry_at = None if webmention.sent_revision is None: webmention.processed_revision = source.revision @@ -536,7 +540,11 @@ def scan_sources() -> None: sa.or_( SentWebmention.processed_revision.is_(None), SentWebmention.processed_revision < SentWebmention.desired_revision, - ) + ), + sa.or_( + SentWebmention.next_retry_at.is_(None), + SentWebmention.next_retry_at <= scan_time, + ), ) .order_by(SentWebmention.uuid) ): |
