-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Pass timeout to TimeoutRejectedException #2827
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
Conversation
Pass the value of `timeout` to `TimeoutRejectedException` in Polly for timeout policies. Resolves #2815.
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.
Pull request overview
This PR enhances the TimeoutRejectedException by passing the timeout value that caused the exception, making it easier for consumers to understand and handle timeout scenarios.
- Timeout parameter is now passed to
TimeoutRejectedExceptionin both synchronous and asynchronous timeout engines - Tests updated to verify the timeout value is correctly set in the exception
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Polly/Timeout/TimeoutEngine.cs | Updated to pass timeout parameter when throwing TimeoutRejectedException |
| src/Polly/Timeout/AsyncTimeoutEngine.cs | Updated to pass timeout parameter when throwing TimeoutRejectedException in async scenarios |
| test/Polly.Specs/Timeout/TimeoutSpecs.cs | Added test assertion to verify timeout value is set correctly in pessimistic strategy |
| test/Polly.Specs/Timeout/TimeoutAsyncSpecs.cs | Added test assertion to verify timeout value is set correctly in async pessimistic strategy |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2827 +/- ##
=======================================
Coverage 96.15% 96.15%
=======================================
Files 309 309
Lines 7123 7123
Branches 1005 1005
=======================================
Hits 6849 6849
Misses 221 221
Partials 53 53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Updated [Polly.Core](https://github.com/App-vNext/Polly) from 8.6.4 to 8.6.5. <details> <summary>Release notes</summary> _Sourced from [Polly.Core's releases](https://github.com/App-vNext/Polly/releases)._ ## 8.6.5 ## What's Changed * Extend NuGet package validation by @martincostello in App-vNext/Polly#2762 * Suppress S2094 warning by @martincostello in App-vNext/Polly#2765 * Refactor cake script by @martincostello in App-vNext/Polly#2769 * Pass timeout to `TimeoutRejectedException` by @martincostello in App-vNext/Polly#2827 **Full Changelog**: App-vNext/Polly@8.6.4...8.6.5 Commits viewable in [compare view](App-vNext/Polly@8.6.4...8.6.5). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Gunn <james@gunn.io>
Pass the value of
timeouttoTimeoutRejectedExceptioninPollyfor timeout policies.Resolves #2815.