Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: add 502 errors to retry logic #769

Merged
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 lib/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ util.makeWritableStream = makeWritableStream;
*/
function shouldRetryRequest(err) {
if (err) {
if ([429, 500, 503].indexOf(err.code) !== -1) {
if ([429, 500, 502, 503].indexOf(err.code) !== -1) {
return true;
}

Expand Down
7 changes: 7 additions & 0 deletions test/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,13 @@ describe('common/util', function() {
assert.strictEqual(util.shouldRetryRequest(error), true);
});

it('should return true with error code 502', function() {
var error = new Error('502');
error.code = 502;

assert.strictEqual(util.shouldRetryRequest(error), true);
});

it('should return true with error code 503', function() {
var error = new Error('503');
error.code = 503;
Expand Down