From f33e6e3b095c2ac957e0ae0c8df6bb07a884daab Mon Sep 17 00:00:00 2001 From: Ali Toosi Date: Tue, 26 Nov 2024 10:33:38 +1100 Subject: [PATCH] Take account of maximumDelay in LinearRetryPolicy --- pubnub/lib/src/core/policies/retry_policy.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pubnub/lib/src/core/policies/retry_policy.dart b/pubnub/lib/src/core/policies/retry_policy.dart index a92e1975..222761ca 100644 --- a/pubnub/lib/src/core/policies/retry_policy.dart +++ b/pubnub/lib/src/core/policies/retry_policy.dart @@ -41,7 +41,8 @@ class LinearRetryPolicy extends RetryPolicy { @override Duration getDelay(Fiber fiber) { return Duration( - milliseconds: (fiber.tries * backoff) + Random().nextInt(1000)); + milliseconds: min(maximumDelay, + (fiber.tries * backoff) + Random().nextInt(1000))); } }