Skip to content

Commit

Permalink
Merge pull request #252 from dxdc/patch-1
Browse files Browse the repository at this point in the history
fix retry logic "Unable to find Bond for IP Address" #229
  • Loading branch information
aarons22 authored Nov 28, 2023
2 parents 9c3bcf4 + 8b3a128 commit c1aadfa
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/BondApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ export class BondApi {
this.bondToken = bondToken;
this.uri = new BondUri(ipAddress);

axiosRetry(axios, { retries: 10, retryDelay: axiosRetry.exponentialDelay });
axiosRetry(axios, {
retries: 10,
retryDelay: axiosRetry.exponentialDelay,
shouldResetTimeout: true,
retryCondition: (error) => {
const shouldRetry = axiosRetry.isNetworkOrIdempotentRequestError(error) || error.code === 'ECONNABORTED';

this.platform.log.debug(`Retrying: ${shouldRetry ? 'YES' : 'NO'}`, {
url: error.config?.url,
method: error.config?.method,
errorCode: error.code,
responseStatus: error.response?.status,
});

return shouldRetry;
},
});
}

// Bond / Device Info
Expand Down Expand Up @@ -306,7 +322,7 @@ export class BondApi {
'BOND-Token': this.bondToken,
'Bond-UUID': bondUuid,
},
timeout: 1000,
timeout: 2000,
});
}

Expand Down

0 comments on commit c1aadfa

Please sign in to comment.