-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Protect against retry delay overflows #1522
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering what's the use case for trapping the overflow, rather than throwing an exception and the user fixing their code/configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, maybe this really should be handled outside of Polly?
For example similar to how done here:
https://github.com/dotnet/extensions/blob/f1175430d64364b2a90e0188ba5caa8042c339f3/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/ValidationHelper.cs#L49
One use-case is really high number of retries, at some point the retry strategy will will fail with overflow.
Is it an user-error or Polly error?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martintmk
A kinda weird use case just bumped into my mind. (It is slightly related to this overflow problem) On StackOverflow once I have seen a question where the OP wanted to use the retry policy to schedule jobs to run them periodically (say once in a day).
I highly discouraged the OP to use Polly V7 for that. But what's the case for V8? Is the new implementation suitable for this use case? Or should be people directed to dedicated job scheduler solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not seems to be the use-case of Polly. Yes, you can misuse retries to do "periodical" executions, but eyebrows would be raised :)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think would it make sense to have an "anti-patterns" section on the wiki/readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are enough of those, I would say yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd agree - using Polly to do that sounds like a case of "when you have a hammer, everything looks like a nail".
We could maybe document anti-patterns, but I would only do so for things that are common mistakes or there's subtlety as to why they are - otherwise the number of things you shouldn't use Polly for is basically infinite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will collect anti-patterns that I have seen on SO in the past 3 years and I'll create an issue to discuss them and come up with suggested alternatives for V8