-
-
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
The ExecuteCoreAsync method is now Outcome based #1195
Conversation
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.
Nice.
d7bbafb
to
67b58b6
Compare
I'm not crazy about the perf hit, but I think the improvements are warranted. |
Ok, I'll go ahead, polish this and prepare for merging. |
2aa54de
to
8a79609
Compare
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #1195 +/- ##
==========================================
+ Coverage 83.31% 83.70% +0.39%
==========================================
Files 277 278 +1
Lines 6286 6439 +153
Branches 1023 1023
==========================================
+ Hits 5237 5390 +153
Misses 844 844
Partials 205 205
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/// <summary> | ||
/// Gets the <see cref="ExceptionDispatchInfo"/> associated with the exception, if any. | ||
/// </summary> | ||
internal ExceptionDispatchInfo? ExceptionDispatchInfo { get; } |
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.
Given this new property, then you should change the Exception property to just
public Exception? => ExceptionDispatchInfo?.SourceException;
which would shrink the Outcome
and Outcome<T>
structs by 1/3, speeding up all that struct copying.
c727b70
to
dacf762
Compare
Details on the issue fix or feature implementation
This change simplifies the implementation of strategies and improves performance in cases when there are many exceptions thrown (i.e. circuit breaker is opened).
The perf impact of this change is non-trivial. It comes from wrapping the user-callback and converting it to outcome-based one. If caller provides the outcome-based compatible callback the impact is minimal (demonstrated in the
ResilienceStrategyBenchmark
).Benefits:
Outcome
in the future.Outcome
-based API to take advantage of this. By default, the perf will be around the same if the normalExecute
methods are used.Downsides:
Benchmark for error cases:
Confirm the following