aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/sender.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-13 20:03:49 +0100
committerDennis Fink2026-11-13 20:03:49 +0100
commit87117345ed6e99e5a070d919ac17139cba7b8fe4 (patch)
treed7df5d45008dd2959194e2614b87333598b85198 /webmentions_ssg/tasks/sender.py
parent2fbe1d383650cb31f3ef8d58c04e4d4095935833 (diff)
downloadwebmentions-ssg-87117345ed6e99e5a070d919ac17139cba7b8fe4.tar.gz
webmentions-ssg-87117345ed6e99e5a070d919ac17139cba7b8fe4.zip
fix(core): make network task failures explicit
Introduce a dedicated response-size error so callers only translate expected limit violations instead of masking unrelated `ValueError` exceptions. Ensure failed sockets are always closed, remove dead discovery error handling, and log unexpected sender failures with tracebacks before recording them.
Diffstat (limited to 'webmentions_ssg/tasks/sender.py')
-rw-r--r--webmentions_ssg/tasks/sender.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/webmentions_ssg/tasks/sender.py b/webmentions_ssg/tasks/sender.py
index db99476..cd6c64a 100644
--- a/webmentions_ssg/tasks/sender.py
+++ b/webmentions_ssg/tasks/sender.py
@@ -210,10 +210,8 @@ def send_webmention_task(webmention_uuid: uuid.UUID) -> None:
httpx.InvalidURL,
httpx.UnsupportedProtocol,
httpx.LocalProtocolError,
- ValueError,
- UnicodeError,
) as exc:
- # Invalid URLs and local protocol errors cannot improve with retries.
+ # Known permanent failures cannot improve with retries.
outcome = SentWebmentionStatus.FAILED
reason = str(exc) or type(exc).__name__
except (TemporarySenderError, AddressResolutionError, httpx.RequestError) as exc:
@@ -221,6 +219,14 @@ def send_webmention_task(webmention_uuid: uuid.UUID) -> None:
reason = str(exc) or "Webmention request failed"
terminal = attempt >= max_attempts
temporary_failure = True
+ except Exception as exc:
+ # Unexpected errors must not disappear into a generic permanent-failure
+ # handler without a traceback (including programming ValueErrors).
+ current_app.logger.exception(
+ "Unexpected error sending SentWebmention %s", webmention_uuid
+ )
+ outcome = SentWebmentionStatus.FAILED
+ reason = str(exc) or type(exc).__name__
# A scanner may have reopened or superseded the revision during I/O.
# Refresh only once, and persist one outcome atomically with its metadata.