aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/models.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-30 13:24:53 +0100
committerDennis Fink2026-10-30 13:24:53 +0100
commitf6d96df2c3aecb51ca97426efddb101dce6350d7 (patch)
tree2968f65a627fbfd15051277d07eaa321db0e3cc4 /webmentions_ssg/models.py
parent2b59a3082000842d980f9e19931949dbe5011229 (diff)
downloadwebmentions-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/models.py')
-rw-r--r--webmentions_ssg/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/webmentions_ssg/models.py b/webmentions_ssg/models.py
index 11740a8..4f688e5 100644
--- a/webmentions_ssg/models.py
+++ b/webmentions_ssg/models.py
@@ -245,6 +245,14 @@ class SentWebmention(Base):
)
status_url: Mapped[str | None] = mapped_column(Text(), nullable=True, default=None)
+ # Retry state belongs to the desired revision, not to the target forever.
+ attempt_count: Mapped[int] = mapped_column(
+ Integer(), nullable=False, default=0
+ )
+ next_retry_at: Mapped[datetime | None] = mapped_column(
+ DateTime(timezone=True), nullable=True, default=None
+ )
+
last_attempted_at: Mapped[datetime | None] = mapped_column(
DateTime(timezone=True), nullable=True, default=None
)