From 83af43b7a91aa39998b43752ddd8ead2e78b8090 Mon Sep 17 00:00:00 2001 From: "bojan.malinic" Date: Mon, 12 Aug 2024 13:18:03 +0200 Subject: [PATCH] Throw exception if sleep interval is less than minimal polling time --- src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs b/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs index 43ebab2b..ccd02ea1 100644 --- a/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs +++ b/src/ConductorSharp.Engine/Polling/InverseExponentialBackoff.cs @@ -20,6 +20,9 @@ public int CalculateDelay( int currentSleepInterval ) { + if (baseSleepInterval < _recoveryValue) + throw new ArgumentException($"Sleep interval must be greater than or equal than {_recoveryValue}ms"); + if (taskToWorkerList.Count > 0) { currentSleepInterval /= _backoffRatio;