Skip to content
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

Closed

Conversation

DashaBulanova
Copy link
Contributor

No description provided.

@DashaBulanova DashaBulanova requested a review from Ceridan October 21, 2020 13:26
Copy link
Contributor

@Ceridan Ceridan left a 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.


public static IRetrySettings Default() => new JitterRetrySettings(Defaults.Retry.RetryCount);
public Action<DelegateResult<HttpResponseMessage>, TimeSpan> OnRetry { get; set; }

private static readonly TimeSpan _defaultMedianFirstRetryDelay =
Copy link
Contributor

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.

Copy link
Contributor Author

@DashaBulanova DashaBulanova Oct 21, 2020

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))
Copy link
Contributor

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.

@Ceridan Ceridan added the hacktoberfest-accepted Hacktoberfest label Oct 21, 2020
@Ceridan
Copy link
Contributor

Ceridan commented Nov 1, 2020

I think we should close this PR according to changes in #43, #46 and #47

@Ceridan Ceridan closed this Nov 1, 2020
@Ceridan Ceridan deleted the issue-38-httpclientsettings-refactoring branch November 14, 2020 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants