Skip to content

Commit

Permalink
refactor: add configurable log interval
Browse files Browse the repository at this point in the history
  • Loading branch information
enigbe committed Feb 1, 2024
1 parent d3ea832 commit 6bf8f83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"capacity_multiplier": 2,
"no_results": false,
"log_interval": 60
}
}
2 changes: 1 addition & 1 deletion sim-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ mod test {
assert_eq!(Some(conf.no_results), cli.no_results);

}
}
}
6 changes: 5 additions & 1 deletion sim-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ pub struct Simulation {
activity_multiplier: f64,
/// Configurations for printing results to CSV. Results are not written if this option is None.
write_results: Option<WriteResults>,
/// Duration after which results are logged
log_interval: u64,
}

#[derive(Clone)]
Expand All @@ -352,6 +354,7 @@ impl Simulation {
expected_payment_msat: u64,
activity_multiplier: f64,
write_results: Option<WriteResults>,
log_interval: u64,
) -> Self {
let (shutdown_trigger, shutdown_listener) = triggered::trigger();
Self {
Expand All @@ -363,6 +366,7 @@ impl Simulation {
expected_payment_msat,
activity_multiplier,
write_results,
log_interval,
}
}

Expand Down Expand Up @@ -559,7 +563,7 @@ impl Simulation {
tasks.spawn(run_results_logger(
listener.clone(),
result_logger.clone(),
Duration::from_secs(60),
Duration::from_secs(self.log_interval),
));

tasks.spawn(consume_simulation_results(
Expand Down

0 comments on commit 6bf8f83

Please sign in to comment.