Skip to content

Commit

Permalink
Retry on DNS query timeouts (#274)
Browse files Browse the repository at this point in the history
These are likely itermittent and so retryable.

Co-authored-by: Christopher Hogan <[email protected]>
  • Loading branch information
chrismikehogan and Christopher Hogan authored Jun 28, 2020
1 parent 0190100 commit 744b484
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nest-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Connection {
} catch(error) {
error.status = error.response && error.response.status;
this.error('Access token acquisition via googleAuth failed (code ' + (error.status || error.code) + ').');
if (['ECONNREFUSED','ESOCKETTIMEDOUT','ECONNABORTED','ENETUNREACH'].includes(error.code)) {
if (['ECONNREFUSED','ESOCKETTIMEDOUT','ECONNABORTED','ENETUNREACH','EAI_AGAIN'].includes(error.code)) {
this.error('Retrying in ' + API_AUTH_FAIL_RETRY_DELAY_SECONDS + ' second(s).');
await Promise.delay(API_AUTH_FAIL_RETRY_DELAY_SECONDS * 1000);
return await this.auth();
Expand Down

0 comments on commit 744b484

Please sign in to comment.