From 1179b6f8f275144a1adc4a518d54bf26a10986ca Mon Sep 17 00:00:00 2001 From: Satheesh Kannan Date: Tue, 30 Jul 2024 16:05:38 +0530 Subject: [PATCH] chore: address the sonarcloud issue --- Sources/Classes/RSExponentialBackOff.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Classes/RSExponentialBackOff.m b/Sources/Classes/RSExponentialBackOff.m index 1db63a9b..d4026026 100644 --- a/Sources/Classes/RSExponentialBackOff.m +++ b/Sources/Classes/RSExponentialBackOff.m @@ -35,7 +35,9 @@ - (instancetype)initWithMaximumDelay:(int) seconds { * Function will calculate the next delay value in seconds */ - (int)nextDelay { - int delay = (int)pow(2, _attempt++); + int delay = (int)pow(2, _attempt); + _attempt = _attempt + 1; + int jitter = arc4random_uniform((delay + 1)); int exponentialDelay = _initialDelay + delay + jitter;