-
Notifications
You must be signed in to change notification settings - Fork 5
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
Issue 38 httpclientsettings refactoring #42
Issue 38 httpclientsettings refactoring #42
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.
It is a great effort and huge refactoring. Thank you so much! I think we should discuss a few moments, especially about MedianFirstRetryDelay.
src/Dodo.HttpClient.ResiliencePolicies/CircuitBreakerSettings/CircuitBreakerSettings.cs
Show resolved
Hide resolved
src/Dodo.HttpClient.ResiliencePolicies/RetrySettings/JitterRetrySettings.cs
Show resolved
Hide resolved
src/Dodo.HttpClient.ResiliencePolicies/RetrySettings/JitterRetrySettings.cs
Outdated
Show resolved
Hide resolved
|
||
public static IRetrySettings Default() => new JitterRetrySettings(Defaults.Retry.RetryCount); | ||
public Action<DelegateResult<HttpResponseMessage>, TimeSpan> OnRetry { get; set; } | ||
|
||
private static readonly TimeSpan _defaultMedianFirstRetryDelay = |
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.
Should we add MedianFirstRetryDelay as a public property too? It was possible to set it in the previous version of the JitterRetrySettings and it is important parameter for this type of settings.
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 think it doesn't make sense.
In the previous version, this parameter can be sent directly to sleepDurationProvider via constructor, and the property MedianFirstRetryDelay itself wasn't used.
int retryCount,
TimeSpan medianFirstRetryDelay,
Action<DelegateResult<HttpResponseMessage>, TimeSpan> onRetry)
{
RetryCount = retryCount;
SleepDurationProvider = _defaultSleepDurationProvider(retryCount, medianFirstRetryDelay);
OnRetry = onRetry;
}
The second thought is in this design version of settings classes If we add a public property MedianFirstRetryDelay we don't have control over when it will be filled and this means that we don't know when we should change the sleepDurationProvider.
new JitterRetrySettings | ||
{ | ||
RetryCount = retryCount, | ||
SleepDurationProvider = JitterRetrySettings._defaultSleepDurationProvider(retryCount, TimeSpan.FromMilliseconds(50)) |
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.
It is not the same logic here as it was before. Actually we should fill absent MedianFirstRetryDelay and do not set SleepDurationProvider at all, because JutterRetrySettings will take correct provider by default. We should discuss it.
No description provided.