-
-
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
Improve usability of ResilienceStrategy<T> #1428
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.
Just not a big fan of the name T
as it's not very descriptive alongside TResult
and TState
and might cause some confusion between T
and TResult
when both are kinda a result (just in different contexts).
/// <typeparam name="TState">The type of state associated with the callback.</typeparam> | ||
/// <param name="callback">The user-provided callback.</param> | ||
/// <param name="context">The context associated with the callback.</param> | ||
/// <param name="state">The state associated with the callback.</param> | ||
/// <returns>The instance of <see cref="ValueTask"/> that represents the asynchronous execution.</returns> | ||
/// <exception cref="ArgumentNullException">Thrown when <paramref name="callback"/> or <paramref name="context"/> is <see langword="null"/>.</exception> | ||
public ValueTask<TResult> ExecuteAsync<TState>( | ||
Func<ResilienceContext, TState, ValueTask<TResult>> callback, | ||
public ValueTask<T> ExecuteAsync<T, TState>( |
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 wonder if there's a better name we can give this rather than T
?
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.
Any suggestions?
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.
Maybe just swap T with TResult?
So it will be ResilienceStrategy<T>
but individual methods will have TResult
?
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 didn't have any good suggestions - your one sounds fine to me.
Codecov Report
@@ Coverage Diff @@
## main #1428 +/- ##
=======================================
Coverage 83.92% 83.92%
=======================================
Files 275 275
Lines 6526 6526
Branches 1007 1007
=======================================
Hits 5477 5477
Misses 840 840
Partials 209 209
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Details on the issue fix or feature implementation
These changes enable flowing the type used in the callback back to the result:
Previously, these all would be object:
Confirm the following