feat(provider): timeout, 429 retry and 409 handling for Mollie calls #148

Stängd
öppnade 2026-10-12 13:15:06 +00:00 av supernaut · 0 kommentarer
Ägare

The SDK retries only 5xx. A 429 is returned at once, and requests have no timeout (src/provider/mollie.ts, src/billing.ts:478-494).

Mollie:

Use retry and backoff logic ... Check the Retry-After and RateLimit headers

https://docs.mollie.com/reference/rate-limiting

Mollie webhook calls time out after 15 seconds (https://docs.mollie.com/reference/webhooks).

Failing cases: a 429 during startCheckout fails the customer's checkout. A stalled connection holds a webhook handler for minutes. A 429 during the sweep or reconciliation aborts the whole pass, because listPayments and listChargebacks page through everything.

Fix: give each Mollie call AbortSignal.timeout(10_000). Retry a 429 once or twice on read paths, honouring Retry-After.

Also (folded in from #86):

  • Write paths: retry a 429 with the same idempotency key, honouring Retry-After, with a capped number of attempts.
  • A 409 means a request with the same idempotency key is still in flight. Treat it as "in flight, retry later", with the same key. Keys expire after 1 hour (https://docs.mollie.com/reference/api-idempotency).
  • One wrapper in the adapter, not per call site.

Done when:

  • A unit test with a fake fetch returning 429 then 200 proves the call succeeds and waits as told.
  • A unit test returning 409 then 200 proves a write retries with the same key.
  • A stalled call is aborted after the timeout.
The SDK retries only 5xx. A 429 is returned at once, and requests have no timeout (`src/provider/mollie.ts`, `src/billing.ts:478-494`). Mollie: > Use retry and backoff logic ... Check the `Retry-After` and `RateLimit` headers https://docs.mollie.com/reference/rate-limiting Mollie webhook calls time out after 15 seconds (https://docs.mollie.com/reference/webhooks). Failing cases: a 429 during `startCheckout` fails the customer's checkout. A stalled connection holds a webhook handler for minutes. A 429 during the sweep or reconciliation aborts the whole pass, because `listPayments` and `listChargebacks` page through everything. Fix: give each Mollie call `AbortSignal.timeout(10_000)`. Retry a 429 once or twice on read paths, honouring `Retry-After`. Also (folded in from #86): - Write paths: retry a 429 with the same idempotency key, honouring `Retry-After`, with a capped number of attempts. - A 409 means a request with the same idempotency key is still in flight. Treat it as "in flight, retry later", with the same key. Keys expire after 1 hour (https://docs.mollie.com/reference/api-idempotency). - One wrapper in the adapter, not per call site. Done when: - [ ] A unit test with a fake fetch returning 429 then 200 proves the call succeeds and waits as told. - [ ] A unit test returning 409 then 200 proves a write retries with the same key. - [ ] A stalled call is aborted after the timeout.
supernaut lade till detta till projektet Bitborg Payment 2026-10-12 13:16:16 +00:00
supernaut ändrade titeln från feat(provider): timeout and 429 retry for Mollie calls till feat(provider): timeout, 429 retry and 409 handling for Mollie calls 2026-10-12 18:03:54 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment#148
Ingen beskrivning angiven.