Skip to content

Commit

Permalink
Fixed division by 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragostis committed Sep 20, 2024
1 parent da96ec5 commit 55d927e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,14 @@ fn execute_heartbeat(
.is_some()
});

heartbeat_interval / lock.heartbeats.len() as u32
heartbeat_interval.checked_div(lock.heartbeats.len() as u32)
};

thread::sleep(interval_between_workers);
// If there are no heartbeats (`lock.heartbeats.len()` is 0), skip
// immediately to the next iteration of the loop to trigger the wait.
if let Some(interval_between_workers) = interval_between_workers {
thread::sleep(interval_between_workers);
}
}

Some(())
Expand Down

0 comments on commit 55d927e

Please sign in to comment.