aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/receiver.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/tasks/receiver.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/webmentions_ssg/tasks/receiver.py b/webmentions_ssg/tasks/receiver.py
index feb6823..ada89f8 100644
--- a/webmentions_ssg/tasks/receiver.py
+++ b/webmentions_ssg/tasks/receiver.py
@@ -42,8 +42,7 @@ RECOVERY_EXHAUSTED_REASON = "Verification recovery limit reached"
def fetch_source(source_url: str) -> tuple[httpx.Response, bytes]:
- """
- Fetch a webmention source document.
+ """Fetch a webmention source document.
The request follows redirects while enforcing the configured timeout,
redirect limit, and maximum response size.
@@ -55,7 +54,6 @@ def fetch_source(source_url: str) -> tuple[httpx.Response, bytes]:
:raises VerificationError: If the source returns another unsuccessful HTTP
status or exceeds the configured maximum response size.
"""
-
try:
with (
build_client(
@@ -89,8 +87,7 @@ def fetch_source(source_url: str) -> tuple[httpx.Response, bytes]:
def source_mentions_target(source_url: str, target_url: str) -> bool:
- """
- Fetch a source and check whether it mentions the target URL.
+ """Fetch a source and check whether it mentions the target URL.
HTML and XHTML sources are inspected for supported URL attributes, while
plain-text sources are searched for the exact target IRI.
@@ -103,7 +100,6 @@ def source_mentions_target(source_url: str, target_url: str) -> bool:
:raises SourceGoneError: If the source explicitly reports that it is gone.
:raises TemporaryFetchError: If fetching the source fails temporarily.
"""
-
response, body = fetch_source(source_url)
media_type = (
@@ -129,8 +125,7 @@ def source_mentions_target(source_url: str, target_url: str) -> bool:
@huey.task(retries=2, retry_delay=50)
def verify_webmention(webmention_uuid: uuid.UUID) -> None:
- """
- Verify a received webmention and persist the result.
+ """Verify a received webmention and persist the result.
The transition into ``verifying`` is an atomic claim. Its ``updated_at``
timestamp acts as a lease version: if a reaper has reclaimed the row while
@@ -230,8 +225,7 @@ def verify_webmention(webmention_uuid: uuid.UUID) -> None:
def recover_stale_webmentions() -> int:
- """
- Requeue verification attempts that were abandoned or lost from the queue.
+ """Requeue verification attempts that were abandoned or lost from the queue.
Recover both stale ``verifying`` rows (workers that died) and stale
``received`` rows (tasks that were never enqueued or were lost). Conditional