-
-
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
[Feature request]: Simpler way to do basic ShouldHandle delegates for retry #2258
Comments
Your proposed solution (as far as I understand) works with single exception type only. You can't chain them. IMHO having different classes for simple and advanced scenarios does not help the usage of the API. If we want to rewrite the predicate builder then we should look at how others have address this problem. Like resilience4j or guava-retrying. |
Exactly - this suggestion is about making the simplest cases easier where you only want to check for one thing, not many. It's just on reflection seems a bit overly-verbose and wasteful to allocate an object and then immediately throw it away. I guess if you cared enough about that you could just write a delegate directly instead, but then you need to account for the ValueTask and Outcome machinery so then it ends up being more complicated. We have all the pieces, they're just hidden away in the internals. |
Hey @martincostello I think making this work will be more difficult, even not possible. The thing is that the predicates are more complex than
Assigning
Now, we cannot do the same for
|
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
Is your feature request related to a specific problem? Or an existing feature?
Doing some changes to an application of my own, it occurred to me that for basic use cases for retries, the syntax is more verbose than it could be:
The
PredicateBuilder
class is a good way to express complex conditions, but needing to allocate the object (and the underlying array) to then create the delegate to assign toShouldHandle
seems a bit over-the-top.It feels like we could add something that's a bit simpler (and then implement
PredicateBuilder
in terms of it).This is just a rough sketch of an idea to see what people think for now, I haven't tried to actually prototype it yet or anything.
Describe the solution you'd like
Something like this, where the existing instance methods in the
PredicateBuilder
would just call new static methods, but simple cases can use them directly:That would then simplify the original example to something like this:
Additional context
No response
The text was updated successfully, but these errors were encountered: