Deliverer
Drains due deliveries through an injected httpx.Client.
The client is the host's: it owns timeouts, proxies, TLS. Tests inject
httpx.Client(transport=httpx.MockTransport(handler)).
__init__
__init__(self, store: WebhookStore, client: httpx.Client) -> None
Bind the store to drain and the client to POST through.
Parameters
storerequired, WebhookStorenone
clientrequired, httpx.Clientnone
tick
tick(self, now_ms: int) -> tuple[models.Delivery, ...]
Attempt every delivery due at now_ms; return the updates.
For each row of store.due(now_ms), in that order: body =
models.delivery_body(event, delivery), signed as
sign.sign(secret, now_ms, body), the signature timestamp is
now_ms, so each attempt is fresh while the BODY stays
byte-identical, then client.post(endpoint.url, content=body.encode("utf-8"), headers=...) carrying
content-type: application/json, X-Auradefi-Event,
X-Auradefi-Delivery, X-Auradefi-Timestamp
(str(now_ms)) and X-Auradefi-Signature. Never json=:
re-serialising would break the signature. Finally
store.record_attempt(...) with the status code, or with
status_code=None, error=str(exc) for any
_CLIENT_ERRORS: nothing propagates, one dead receiver
must not stop the drain. Returns the updated rows in the order
attempted, () when nothing is due (and then no request is
made at all).
Parameters
now_msrequired, intnone