bluebird-retry icon indicating copy to clipboard operation
bluebird-retry copied to clipboard

Change args on Retry?

Open mfinegold-cambia opened this issue 3 years ago • 0 comments

We are calling a service that requires a slightly different Authorization token on each retry request ( HMAC token ). I'd like to use the args option to call a function to regenerate the token on each retry ( the function attachAuthHeader(requestConfig, log) below ), but when I look at all the retry requests going down the wire, bb retry still seems to be holding onto the original token, so doesn't look like my function is getting invoked on each retry. Is there some other way to do this?

Code looks like :

return bbRetry(request-promise, { interval: 1000, backoff: 2, max_tries: 2, predicate: err => { const predResult = defaultPredicate(err, log) && (_.isFunction(condition) ? condition(err) : true); return predResult; }, throw_original: true, context, args: [attachAuthHeader(requestConfig, log)] }); }

mfinegold-cambia avatar Jul 20 '21 20:07 mfinegold-cambia