Skip to content

Commit

Permalink
hotfix: divide by 0 in SortingTelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
gd-0 committed Feb 11, 2025
1 parent 03632cc commit a21d7c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion based/crates/sequencer/src/sorting/sorting_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ pub struct SortingTelemetry {
n_sims_succesful: usize,
tot_sim_time: Duration,
}

impl SortingTelemetry {
#[tracing::instrument(skip_all, name = "sorting_telemetry")]
pub fn report(&self) {
tracing::info!(
"{} total sims: {}% success, tot simtime {}",
self.n_sims_sent,
(self.n_sims_succesful * 10000 / self.n_sims_errored) as f64 / 100.0,
if self.n_sims_errored == 0 {
100.0
} else {
(self.n_sims_succesful * 10000 / self.n_sims_errored) as f64 / 100.0
},
self.tot_sim_time
);
}
Expand Down

0 comments on commit a21d7c2

Please sign in to comment.