-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add RetryAfter
to BrokenCircuitException
.
#2324
Add RetryAfter
to BrokenCircuitException
.
#2324
Conversation
RetryAfter
to BrokenCircuitException
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2324 +/- ##
==========================================
+ Coverage 85.39% 85.40% +0.01%
==========================================
Files 313 313
Lines 7461 7467 +6
Branches 1126 1126
==========================================
+ Hits 6371 6377 +6
Misses 745 745
Partials 345 345
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I would keep this feature to |
Yes, that's my understand as well. Your implementation should be limited to V8 only. |
Also, please don't forget to update the documentation as well: https://github.com/App-vNext/Polly/blob/main/docs/strategies/circuit-breaker.md |
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 agree, we should just make this change to Polly.Core.
src/Polly.Core/CircuitBreaker/Controller/CircuitStateController.cs
Outdated
Show resolved
Hide resolved
test/Polly.Core.Tests/CircuitBreaker/IsolatedCircuitExceptionTests.cs
Outdated
Show resolved
Hide resolved
16dd9ad
to
29f6e84
Compare
The source branch is rebased, revised, and force-pushed to incorporate the following requested changes:
|
test/Polly.Core.Tests/CircuitBreaker/BrokenCircuitExceptionTests.cs
Outdated
Show resolved
Hide resolved
test/Polly.Core.Tests/CircuitBreaker/IsolatedCircuitExceptionTests.cs
Outdated
Show resolved
Hide resolved
New commits are added to:
|
6fb3dff
to
b3e0aaa
Compare
test/Polly.Core.Tests/CircuitBreaker/BrokenCircuitExceptionTests.cs
Outdated
Show resolved
Hide resolved
b3e0aaa
to
9a93845
Compare
Thanks for your contribution @DL444 - the changes from this pull request have been published as part of version 8.5.0 📦, which is now available from NuGet.org 🚀 |
Pull Request
The issue or feature being addressed
Closes #2284
Details on the issue fix or feature implementation
This PR adds
RetryAfter
property toBrokenCircuitException
to indicate time of possible circuit closure.The implementation stores the time span from the time when the exception is thrown to the time when the circuit breaker should enter half-open state. This can cause inaccuracy if the exception is stowed and consumed at a later time, as the value would become stale. This route is chosen over storing the time of circuit closure because it
RateLimiterRejectedException
, another derived type ofExecutionRejectedException
, whoseRetryAfter
was already defined to returnTimeSpan
.Tests are expanded to cover the new APIs. Specific test policy proposed and implemented:
BrokenCircuitExceptionTests
,IsolatedCircuitExceptionTests
) are expanded to cover the new API;CircuitBreakerSpecs
,CircuitBreakerAsyncSpecs
,AdvancedCircuitBreakerSpecs
,AdvancedCircuitBreakerAsyncSpecs
,CircuitBreakerTResultSpecs
,CircuitBreakerTResultMixedResultExceptionSpecs
,CircuitBreakerTResultAsyncSpecs
) implements one test for the value of the newRetryAfter
property.Let me know if either the implementation or the tests need rework.
It is also observed that
BrokenCircuitException
supports binary serialization on .NET Framework. I'm unfortunately not familiar with its details, and as a deprecated technology, information about it online is scarce. I'm not sure if this change would have any negative implications from a compatibility standpoint.Confirm the following