From 38c169f76ceee20f397d486b7321da3cd3c52d44 Mon Sep 17 00:00:00 2001 From: Satheesh Kannan Date: Tue, 30 Jul 2024 15:25:06 +0530 Subject: [PATCH] chore: address the sonarcloud issue This fix will eliminate the implicit conversion loses integer precision issue --- Sources/Classes/RSExponentialBackOff.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Classes/RSExponentialBackOff.m b/Sources/Classes/RSExponentialBackOff.m index fae72b3c..1db63a9b 100644 --- a/Sources/Classes/RSExponentialBackOff.m +++ b/Sources/Classes/RSExponentialBackOff.m @@ -10,9 +10,9 @@ #pragma mark - RSExponentialBackOff @interface RSExponentialBackOff() -@property (nonatomic, assign) NSInteger attempt; -@property (nonatomic, assign) NSInteger maximumDelay; -@property (nonatomic, assign) NSInteger initialDelay; +@property (nonatomic, assign) int attempt; +@property (nonatomic, assign) int maximumDelay; +@property (nonatomic, assign) int initialDelay; @end @implementation RSExponentialBackOff @@ -35,7 +35,7 @@ - (instancetype)initWithMaximumDelay:(int) seconds { * Function will calculate the next delay value in seconds */ - (int)nextDelay { - int delay = pow(2, _attempt++); + int delay = (int)pow(2, _attempt++); int jitter = arc4random_uniform((delay + 1)); int exponentialDelay = _initialDelay + delay + jitter;