Repository navigation
add filter option to retry() and retryable(). PR for #1256. - #1261
Conversation
…ring and control of retry flow. Resolves #1256.
| * * `interval` - The time to wait between retries, in milliseconds. The | ||
| * default is `0`. The interval may also be specified as a function of the | ||
| * retry count (see example). | ||
| * * `filter` - Synchronous function that is invoked on erroneous result with the |
There was a problem hiding this comment.
I don't think filter is the right term for this. Perhaps continueOperation or something? /cc @hargasinski @aearly
Also this should be documented as optional
There was a problem hiding this comment.
👍 for continueOperation. I'd also be open to errorFilter from the issue,
Also, you don't need to run the script to generate the documentation. Just make sure the tests pass.
There was a problem hiding this comment.
I wasn't fan of filter either. Most of the do / while type of functions within async use test... maybe something similar to that? continueTest?
There was a problem hiding this comment.
Missed the comment somehow. Thanks for the feedback. I will change it to continueOperation.
There was a problem hiding this comment.
errorFilter/errorTest/shouldError/onError/shouldContinueOnError
I think continueOperation is a bit misleading, because it's not something you do when you continue, it's a test/callback to see if you should continue or not.
Cache invalidation and naming things....
There was a problem hiding this comment.
I like errorFilter or errorTest. Another option I suppose is retryTest ?
…t documentation and fixed code based on PR feedback.
| * erroneous result with the the error. If it returns `true` the retry attempts | ||
| * will continue, if the function returns `false` the retry flow is aborted | ||
| * with the current attempt's error and result being returned to the final | ||
| * callback. Invoked with (err). |
There was a problem hiding this comment.
isn't it invoked with (error, ...any other arguments)
…mpt condition into one statement
| }); | ||
|
|
||
| setTimeout(function () { | ||
| }, 15); |
There was a problem hiding this comment.
I had used an existing test which had it; and I didn't notice it. Not sure why it's there to be honest. In the latest commit I removed it from the existing test and the new one. Tests pass locally for me, and in CI it seems.
…moved setTimeout from retryable tests
|
Thanks! |
retry()andretryable()to allow for error filtering and control of retry flow. Resolves error filter for retry and retryable #1256.errorFilter.npm test.Fixes #1256 - megawac