Skip to content

Commit

Permalink
chore: address the sonarcloud issue
Browse files Browse the repository at this point in the history
This fix will eliminate the implicit conversion loses integer precision issue
  • Loading branch information
SKannaniOS committed Jul 30, 2024
1 parent 08f9139 commit 38c169f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Classes/RSExponentialBackOff.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 38c169f

Please sign in to comment.