Deliver outgoing activities with retries (phase 2, step 5)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 9s
CI / test (push) Successful in 1m57s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s

The federation.deliver worker task sends queued activities:
- signed POSTs as the user, draft-cavage first and RFC 9421 after a
  401 (double-knocking), several at once (FEDERATION_DELIVERY_
  CONCURRENCY), up to 50 per pass
- 2xx delivered; 410 removes whoever that inbox belongs to as a
  follower and marks them gone; other 4xx (except 401/408/429) are
  abandoned; everything else retries at 1m, 5m, 30m, 2h, 6h, then
  every 12h, abandoned after 2 days
- claiming leases a delivery (pushes its next attempt forward), so a
  crashed worker's sends become due again on their own; claiming
  skips the eager join Postgres can't lock through
- metrics: deliveries by result, delivery time, outgoing signatures,
  queue depths and follower totals (gauges set every 30s)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 21:36:05 +01:00
1 parent 5897e8217f
commit 142dc13fea
6 files changed
+417 -7

No files matched your search

+5 -4
View File
@@ -189,7 +189,8 @@ def sharing_user(fed_ctx, user):
class FakeRemote:
"""A tiny HTTP server standing in for another fediverse server.
`routes[path] = (status, headers, body)`; `requests` records what it received.
`routes[path] = (status, headers, body)` or a function(request) returning that;
`requests` records what it received.
"""
def __init__(self):
@@ -211,9 +212,9 @@ class FakeRemote:
"body": request.get_data(),
}
)
status, headers, body = self.routes.get(request.path, (404, {}, b"not found"))
if callable(body):
body = body(request)
route = self.routes.get(request.path, (404, {}, b"not found"))
# A route is (status, headers, body), or a function of the request returning one
status, headers, body = route(request) if callable(route) else route
if isinstance(body, dict | list):
import json as _json