aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/sender.py
diff options
context:
space:
mode:
Diffstat (limited to 'webmentions_ssg/tasks/sender.py')
-rw-r--r--webmentions_ssg/tasks/sender.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/webmentions_ssg/tasks/sender.py b/webmentions_ssg/tasks/sender.py
index 3f64bed..6b14ace 100644
--- a/webmentions_ssg/tasks/sender.py
+++ b/webmentions_ssg/tasks/sender.py
@@ -32,6 +32,34 @@ from .endpoint_discovery import (
)
+@dataclass(frozen=True)
+class ClaimedSendAttempt:
+ """Claimed source revision and retry budget for one send."""
+
+ webmention_uuid: uuid.UUID
+ revision: int
+ attempt_number: int
+ max_attempts: int
+ source: str
+ target: str
+
+
+@dataclass(frozen=True)
+class DeliveryResult:
+ """HTTP outcome, with whether the failure is eligible for another attempt.
+
+ ``retryable`` describes the failure type; it does not account for the
+ remaining retry budget, which may already have been exhausted.
+ """
+
+ status: SentWebmentionStatus
+ reason: str | None = None
+ endpoint: str | None = None
+ response_status: int | None = None
+ status_url: str | None = None
+ retryable: bool = False
+
+
def revision_still_pending(webmention: SentWebmention, revision: int) -> bool:
"""Check whether a send attempt still represents the desired revision.
@@ -83,34 +111,6 @@ def send_webmention(webmention_uuid: uuid.UUID) -> None:
return
-@dataclass(frozen=True)
-class ClaimedSendAttempt:
- """Claimed source revision and retry budget for one send."""
-
- webmention_uuid: uuid.UUID
- revision: int
- attempt_number: int
- max_attempts: int
- source: str
- target: str
-
-
-@dataclass(frozen=True)
-class DeliveryResult:
- """HTTP outcome, with whether the failure is eligible for another attempt.
-
- ``retryable`` describes the failure type; it does not account for the
- remaining retry budget, which may already have been exhausted.
- """
-
- status: SentWebmentionStatus
- reason: str | None = None
- endpoint: str | None = None
- response_status: int | None = None
- status_url: str | None = None
- retryable: bool = False
-
-
def is_ready_to_send(webmention: SentWebmention, now: datetime) -> bool:
"""Return whether an unprocessed Webmention has reached its retry deadline.