fix(retryer): retry transient network errors with backoff - #510
fix(retryer): retry transient network errors with backoff#510luojiyin1987 wants to merge 1 commit into
Conversation
|
@luojiyin1987 is attempting to deploy a commit to the martin-mfg's projects Team on Vercel. A member of the Team first needs to authorize it. |
2bf2fc0 to
63bd62e
Compare
|
Agreed — reporting "rate limiting" with no rate limit in sight was contradictory. Reworked:
I kept the reason classification at this two-way level for now: a fuller split (new error type per exhaustion reason) would change the public contract, and |
|
Both points addressed: P3: PR descriptionFixed. The body now says:
You are right that "signature is unchanged" was wrong — the signature gained an optional fourth parameter, and only call-site compatibility is guaranteed. P2: mixed-failure attributionAgreed with keeping this out of the PR. I have documented the known limitation and the |
63bd62e to
3963a22
Compare
|
Two updates, mirroring feedback that came out of reviewing the same code on our deployment fork: Rate-limit responses no longer get quick retriesHTTP 429 (and 403 answers carrying a rate-limit message) previously sat in the quick-retry set. They now skip the backoff loop entirely and rotate to the next PAT instead, so callers do not violate GitHub Retry-After / reset guidance. Quick backoff stays reserved for network-level errors and 502/503/504. Covered by a parameterized status matrix ( Tests parameterizedThe per-status tests collapsed into one Full suite: 728 passed. |
Fixes #508
What
retryer()now separates token rotation from transient retry:1s, 2s, 4s) plus jitter before rotation moves to the next token.ECONNRESET,ETIMEDOUT, socket hang up, DNS failures) or when the HTTP status is 502/503/504.Final error message
Exhaustion now reports the real cause instead of always claiming rate limiting:
The
MAX_RETRYtype is kept, sosecondaryMessagemapping stays the same.Tests
packages/core/tests/retryer.test.ts: same-PAT retry after a network error, retry on 502, no retry on 404, immediate throw for non-axios errors, accurate message on transient exhaustion, and no "rate limiting" claim when only transient errors occurred.apps/backend/tests/status.up.test.js: the twonetworkErrortests now use fake timers to advance the backoff schedule.Full suite: 728 passed. Retryer status handling is covered by a parameterized matrix (502/503/504 quick retry, 429 rotate).