From ed5649091deab70cd36dd4ae4cf2d447bd67503d Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 3 Mar 2025 10:53:32 +0100 Subject: [PATCH] Reduce retry attempts and adjust timeout configuration Lowered MaxRetryAttempts from 6 to 4 and reduced the outer timeout to 60 seconds to align with the updated exponential backoff total of 32 seconds. These changes aim to improve efficiency and reduce unnecessary waiting time during transient failures. --- src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs index 9f28e9163..ec8c416f3 100644 --- a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs +++ b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs @@ -265,13 +265,13 @@ public abstract class SendHttpRequestBase : Activity .Handle() // Specific timeout exception .Handle(ex => IsTransientStatusCode(ex.StatusCode)) // Network errors or transient HTTP codes .HandleResult(response => IsTransientStatusCode(response.StatusCode)), - MaxRetryAttempts = 6, + MaxRetryAttempts = 4, 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, 32s, 64s ]. Total secs: 2 + 4 + 8 + 16 + 32 + 64 = 128s. + BackoffType = DelayBackoffType.Exponential // Delay * 2^AttemptNumber, e.g. [ 2s, 4s, 8s, 16s ]. Total secs: 2 + 4 + 8 + 16 = 32. // 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(128 + 60)); // Outer timeout. 128 secs plus grace period for the last attempt. + .AddTimeout(TimeSpan.FromSeconds(60)); // Outer timeout. 32 secs plus grace period of 28 secs for the last attempt. return pipelineBuilder.Build(); }