Skip to content

Commit

Permalink
fix retry logic "Unable to find Bond for IP Address" aarons22#229
Browse files Browse the repository at this point in the history
  • Loading branch information
dxdc authored Nov 8, 2023
1 parent 9c3bcf4 commit 8962f33
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion 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

Check warning on line 45 in src/BondApi.ts

View workflow job for this annotation

GitHub Actions / build (10.x, ubuntu-latest)

Missing trailing comma

Check warning on line 45 in src/BondApi.ts

View workflow job for this annotation

GitHub Actions / build (12.x, ubuntu-latest)

Missing trailing comma

Check warning on line 45 in src/BondApi.ts

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

Missing trailing comma
});

return shouldRetry;
}

Check warning on line 49 in src/BondApi.ts

View workflow job for this annotation

GitHub Actions / build (10.x, ubuntu-latest)

Missing trailing comma

Check warning on line 49 in src/BondApi.ts

View workflow job for this annotation

GitHub Actions / build (12.x, ubuntu-latest)

Missing trailing comma

Check warning on line 49 in src/BondApi.ts

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

Missing trailing comma
});
}

// Bond / Device Info
Expand Down

0 comments on commit 8962f33

Please sign in to comment.