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

HttpTransport: Fixes HttpTimeoutPolicies to not accidentally suppress retries #3944

Merged
2 commits merged into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,7 @@ private static bool IsOutOfRetries(
DateTime startDateTimeUtc,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We could remove the input parameters in the future

IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> timeoutEnumerator)
{
return (DateTime.UtcNow - startDateTimeUtc) > timeoutPolicy.MaximumRetryTimeLimit || // Maximum of time for all retries
!timeoutEnumerator.MoveNext(); // No more retries are configured
return !timeoutEnumerator.MoveNext(); // No more retries are configured
}

private async Task<HttpResponseMessage> ExecuteHttpHelperAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Microsoft.Azure.Cosmos
internal abstract class HttpTimeoutPolicy
{
public abstract string TimeoutPolicyName { get; }
public abstract TimeSpan MaximumRetryTimeLimit { get; }
public abstract int TotalRetryCount { get; }
public abstract IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator();
public abstract bool IsSafeToRetry(HttpMethod httpMethod);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ private HttpTimeoutPolicyControlPlaneRead()

public override string TimeoutPolicyName => HttpTimeoutPolicyControlPlaneRead.Name;

public override TimeSpan MaximumRetryTimeLimit => CosmosHttpClient.GatewayRequestTimeout;

public override int TotalRetryCount => this.TimeoutsAndDelays.Count;

public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ private HttpTimeoutPolicyControlPlaneRetriableHotPath(bool shouldThrow503OnTimeo

public override string TimeoutPolicyName => HttpTimeoutPolicyControlPlaneRetriableHotPath.Name;
FabianMeiswinkel marked this conversation as resolved.
Show resolved Hide resolved

public override TimeSpan MaximumRetryTimeLimit => CosmosHttpClient.GatewayRequestTimeout;

public override int TotalRetryCount => this.TimeoutsAndDelays.Count;

public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ private HttpTimeoutPolicyDefault(bool shouldThrow503OnTimeout)

public override string TimeoutPolicyName => HttpTimeoutPolicyDefault.Name;

public override TimeSpan MaximumRetryTimeLimit => CosmosHttpClient.GatewayRequestTimeout;

public override int TotalRetryCount => this.TimeoutsAndDelays.Count;

public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ private HttpTimeoutPolicyNoRetry()

public override string TimeoutPolicyName => HttpTimeoutPolicyNoRetry.Name;

public override TimeSpan MaximumRetryTimeLimit => TimeSpan.Zero;

public override int TotalRetryCount => 0;

public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator()
Expand Down
Loading