From 9d19db09cffee9e447ccae0232214f1bb378dc8c Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 3 Mar 2025 10:34:55 +0100 Subject: [PATCH] Increase retry attempts and adjust delay/backoff configuration. Updated the retry logic by increasing the max retry attempts from 4 to 6 and reducing the delay per attempt to 1 second. Adjusted the outer timeout to accommodate the new backoff configuration, allowing for a longer retry grace period. --- src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs index 8cdc00b53..9f28e9163 100644 --- a/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs +++ b/src/modules/Elsa.Http/Activities/SendHttpRequestBase.cs @@ -265,12 +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 = 4, + MaxRetryAttempts = 6, 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(2), - BackoffType = DelayBackoffType.Exponential // Delay * 2^AttemptNumber, e.g. [ 4s, 8s, 16s, 32s ]. Total secs: 4 + 8 + 16 + 32 = 64s. + 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. + // 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(94)); // Outer timeout. 64 secs plus grace period for the last attempt. + .AddTimeout(TimeSpan.FromSeconds(128 + 60)); // Outer timeout. 128 secs plus grace period for the last attempt. return pipelineBuilder.Build(); }