Skip to content

Commit

Permalink
Fix int underflow in get_exponential_retry_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
pkolaczk committed Jun 21, 2024
1 parent 9777d96 commit 1ed0f18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pub fn get_exponential_retry_interval(
) -> u64 {
let min_interval_float: f64 = min_interval as f64;
let mut current_interval: f64 =
min_interval_float * (2u64.pow((current_attempt_num - 1).try_into().unwrap_or(0)) as f64);
min_interval_float * (2u64.pow(current_attempt_num.try_into().unwrap_or(0)) as f64);

// Add jitter
current_interval += random::<f64>() * min_interval_float;
Expand Down

0 comments on commit 1ed0f18

Please sign in to comment.