-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Cancel a retry policy #25
Comments
Not right now. Something I've been meaning to do has been allowing you to pass a cancellation token through |
Added: https://github.com/connor4312/cockatiel#retryexecutefn-cancellationtoken Cancelling the token will cause the last error emitted by the function to be bubbled. |
I'm not sure if I'm missing something but I couldn't make the retry policy stop using the cancellation token. Here follow the example of a simple experiment I did to cancel a retry after 5 attempts.
|
You need to pass in the cancellation token, not the source: diff --git a/index.js b/index.js
index ad8a922..32d3c1e 100644
--- a/index.js
+++ b/index.js
@@ -25,7 +25,7 @@ const main = async () => {
const result = await retryPolicy.execute(
() => failCallback(),
- cancellationTokenSource
+ cancellationTokenSource.token
)
console.log(result)
|
That is it. |
Sorry to raise an issue just to ask a question but is there a way to cancel a retry policy?
The use case I'm trying to achieve is if the user attempts to redo the same action that was being retried, would like to cancel the current retry and then create a new retry with the updated data.
Is it possible?
Thanks for the terrific work with this tool.
The text was updated successfully, but these errors were encountered: