aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/models.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 /webmentions_ssg/models.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 'webmentions_ssg/models.py')
-rw-r--r--webmentions_ssg/models.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/webmentions_ssg/models.py b/webmentions_ssg/models.py
index 4f688e5..58f95bc 100644
--- a/webmentions_ssg/models.py
+++ b/webmentions_ssg/models.py
@@ -17,6 +17,7 @@ from sqlalchemy import (
DateTime,
Enum,
ForeignKey,
+ Index,
Integer,
String,
Text,
@@ -116,6 +117,7 @@ class ReceivedWebmention(Base):
__table_args__ = (
UniqueConstraint("source", "target", name="uq_webmention_source_target"),
+ Index("ix_received_webmentions_status_updated_at", "status", "updated_at"),
)
def __repr__(self) -> str:
@@ -246,9 +248,7 @@ 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
- )
+ 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
)