Update retry configuration to retry up to 4 minutes

This commit is contained in:
Raymond den Haan 2025-03-05 14:52:30 +01:00
parent 40a12a623a
commit eb89f78632

View file

@ -266,13 +266,13 @@ public abstract class SendHttpRequestBase : Activity<HttpResponseMessage>
.Handle<TimeoutException>() // Specific timeout exception
.Handle<HttpRequestException>() // Any HTTP exception
.HandleResult(response => IsTransientStatusCode(response.StatusCode)),
MaxRetryAttempts = 4,
MaxRetryAttempts = 10,
UseJitter = false, // If enabled, adds a random value between -25% and +25% of the calculated Delay, except if BackoffType is Exponential, where a DecorrelatedJitterBackoffV2 formula is used for jitter calculation. That formula is based on Polly.Contrib.WaitAndRetry.
Delay = TimeSpan.FromSeconds(1),
BackoffType = DelayBackoffType.Exponential // Delay * 2^AttemptNumber, e.g. [ 2s, 4s, 8s, 16s ]. Total secs: 2 + 4 + 8 + 16 = 30
// If BackoffType is Exponential, then the calculated Delay is multiplied by a random value between -25% and +25% of the calculated Delay, except if BackoffType is Exponential, where a DecorrelatedJitterBackoffV2 formula is used for jitter calculation. That formula is based on Polly.Contrib.WaitAndRetry.
})
.AddTimeout(TimeSpan.FromSeconds(60)); // Outer timeout. 30 secs plus a grace period of 30 secs for the last attempt.
.AddTimeout(TimeSpan.FromSeconds(4*60)); // Outer timeout. 4 minutes, to stay well within range of the default lock time of servicebus messages.
return pipelineBuilder.Build();
}