Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export class Util {
*/
shouldRetryRequest(err?: ApiError) {
if (err) {
if ([408, 429, 500, 502, 503].indexOf(err.code!) !== -1) {
if ([408, 429, 500, 502, 503, 504].indexOf(err.code!) !== -1) {
return true;
}

Expand Down
6 changes: 6 additions & 0 deletions test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,12 @@ describe('common/util', () => {
assert.strictEqual(util.shouldRetryRequest(error), true);
});

it('should return true with error code 504', () => {
const error = new ApiError('504');
error.code = 504;
assert.strictEqual(util.shouldRetryRequest(error), true);
});

it('should detect rateLimitExceeded reason', () => {
const rateLimitError = new ApiError('Rate limit error without code.');
rateLimitError.errors = [{reason: 'rateLimitExceeded'}];
Expand Down