Skip to content

Commit

Permalink
HttpTransport: Fixes HttpTimeoutPolicies to not accidentally suppress…
Browse files Browse the repository at this point in the history
… retries (#3944)

* Fix HttpTimeoutPolicies to not accidentally suppress retries

* Removing HttpTimeoutPolicy.MaxRetryTimeLimit altogether
  • Loading branch information
FabianMeiswinkel authored Jun 27, 2023
1 parent abab80e commit 3a1f46b
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,7 @@ private static bool IsOutOfRetries(
DateTime startDateTimeUtc,
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
1 change: 0 additions & 1 deletion Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicy.cs
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;

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

0 comments on commit 3a1f46b

Please sign in to comment.