Skip to content

Commit 7678923

Browse files
authored
Don't retry on 4xx responses (#4601)
* Don't retry on 4xx responses I'm not sure why this was limited to a small set of 4xx responses. Nominally, no 4xx request should be retried (in fact the comment below says this, but then the code didn't quite match it). This was causing key backup requests to be retried even when the server responded 404 because the backup in question had been deleted, meaning the client would retry uselessly and it would take longer for the client to prompt the user for action. * Exclude 429s
1 parent 6f7c74f commit 7678923

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/http-api/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ export function calculateRetryBackoff(err: any, attempts: number, retryConnectio
180180
return -1;
181181
}
182182

183-
if (err.httpStatus && (err.httpStatus === 400 || err.httpStatus === 403 || err.httpStatus === 401)) {
184-
// client error; no amount of retrying will save you now.
183+
if (err.httpStatus && Math.floor(err.httpStatus / 100) === 4 && err.httpStatus !== 429) {
184+
// client error; no amount of retrying will save you now (except for rate limiting which is handled below)
185185
return -1;
186186
}
187187

0 commit comments

Comments
 (0)