diff options
| author | Dennis Fink | 2026-11-16 09:27:29 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-16 09:27:29 +0100 |
| commit | 85b10c38f39732421a230d938adddc7805d0e001 (patch) | |
| tree | 396f29962fac45245c6f1486e188ad905588659d /webmentions_ssg/tasks/sender.py | |
| parent | eb404d9a1a328278c92753e65100579e7ad98e48 (diff) | |
| download | webmentions-ssg-85b10c38f39732421a230d938adddc7805d0e001.tar.gz webmentions-ssg-85b10c38f39732421a230d938adddc7805d0e001.zip | |
style(core): reorder module declarations
Group globals and data classes near module imports, keep primary classes
and functions together, and move implementation helpers after their
public callers.
Reorder Alembic setup so configuration happens after the required
helpers are defined, without changing runtime behavior.
Diffstat (limited to 'webmentions_ssg/tasks/sender.py')
| -rw-r--r-- | webmentions_ssg/tasks/sender.py | 56 |
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. |
