FGRibreau / FGRibreau/node-request-retry
Custom retry strategy not retrying in certain cases
- Dominant language
- JavaScript
- Stars
- 346
- Forks
- 73
- PR merge metrics
- No merged PRs in 30d
Description
Following the custom retry strategy example below (from the readme):
```js
/**
* @param {Null | Object} err
* @param {Object} response
* @param {Object} body
* @param {Object} options copy
* @return {Boolean} true if the request should be retried
*/
function myRetryStrategy(err, response, body, options){
// retry the request if we had an error or if the response was a 'Bad Gateway'
return err || response.statusCode === 502;
}
```
When `err` is an object and this function returns that object, `mustRetry` becomes `undefined` bypassing the desired retry attempt based on the logic here because `mustRetry.mustRetry` is not a thing in this scenario: https://github.com/FGRibreau/node-request-retry/blob/e72edee56296b7163d18e061975c139f4caf1ff0/index.js#L133-L146
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.