-
-
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 Outcome to the BreakDurationGeneratorArguments #2200
base: main
Are you sure you want to change the base?
Add Outcome to the BreakDurationGeneratorArguments #2200
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.
New entries should go in the Unshipped
file. What you're doing here is effectively "tricking" the Public API analyser into thinking breaking changes aren'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.
Well, that's quite unfortunate. :(
That would require me to create a BreakDurationGeneratorArguments.TResult.cs
. Which is fine but inside the CircuitBreakerStrategyOptions.TResult.cs
I have to create a new generator to make this change backward compatible.
public Func<BreakDurationGeneratorArguments, ValueTask<TimeSpan>>? BreakDurationGenerator { get; set; }
public Func<BreakDurationGeneratorArguments<TResult>, ValueTask<TimeSpan>>? NewBreakDurationGenerator { get; set; }
Do you have any idea how to solve this problem?
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.
Not easily, no - is what you're trying to do achievable via storing the result in the context?
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.
The OnOpened
is called after the break duration calculation, because the OnCircuitOpenedArguments
contains the break duration as well.
So, I can't set the context from the OnOpened
that's why I have to set it inside the user callback. Which is not possible if I decorate my HttpClient
via the AddResilienceHandler
. :(
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 @martintmk has some ideas.
If the type was a class we could just inherit from it and add a generic version, the we wouldn't need to touch the generator but you'd need to do a cast /as
to get the generic version. As it's a struct we can't do that.
I don't think introducing a "NewBreakDurationGenerator" parallel dimension would be a good move and I don't think we'd want to go down the route of a v9 to make this kind of breaking change any time soon.
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.
Yeah, this NewBreakDurationGenerator
idea is non-sense. I've just used it to illustrate the problem.
If my memory serves well this is the 3rd or 4th time when we do not fix something on the API due to backward compatibility. Would it make sense to collect these under a ticket and label it with v9?
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.
We could maybe use the existing breaking change
label and park an issues that would be nice to have but would be breaking there.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2200 +/- ##
==========================================
- Coverage 83.88% 83.87% -0.01%
==========================================
Files 313 313
Lines 7172 7171 -1
Branches 1060 1060
==========================================
- Hits 6016 6015 -1
Misses 785 785
Partials 371 371
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I am thinking, how about we add a |
That could solve the breaking change problem. But the usage of the |
This pull request is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further changes are made. |
This pull request is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further changes are made. |
Pull Request
The issue or feature being addressed
Details on the issue fix or feature implementation
BreakDurationGeneratorArguments
withOutcome
Confirm the following