FGRibreau / FGRibreau/node-request-retry

Custom retry strategy not retrying in certain cases

Open
#98 1 comment 1 reaction 0 assignees View on GitHub
enhancement
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.