Update HTTP resiliency configuration

Removed outer timeout since it was not working in the current set-up
Reduced maximum retry attempts to reduce the maximum amount of time spent on the request
This commit is contained in:
Raymond den Haan 2025-03-06 12:04:02 +01:00
parent aabe6772f5
commit 5a3be276e0

View file

@ -266,13 +266,12 @@ public abstract class SendHttpRequestBase : Activity<HttpResponseMessage>
.Handle<TimeoutException>() // Specific timeout exception
.Handle<HttpRequestException>() // Any HTTP exception
.HandleResult(response => IsTransientStatusCode(response.StatusCode)),
MaxRetryAttempts = 10,
MaxRetryAttempts = 8,
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(4*60)); // Outer timeout. 4 minutes, to stay well within range of the default lock time of servicebus messages.
});
return pipelineBuilder.Build();
}