File tree 6 files changed +145
-88
lines changed
6 files changed +145
-88
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ rand = "0.8.5"
25
25
hex = {version = " 0.4.3" }
26
26
futures = " 0.3.30"
27
27
console-subscriber = { version = " 0.4.0" , optional = true }
28
+ tokio-util = { version = " 0.7.13" , features = [" rt" ] }
28
29
29
30
[features ]
30
31
dev = [" console-subscriber" ]
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use std::collections::HashMap;
12
12
use std:: path:: PathBuf ;
13
13
use std:: sync:: Arc ;
14
14
use tokio:: sync:: Mutex ;
15
+ use tokio_util:: task:: TaskTracker ;
15
16
16
17
/// The default directory where the simulation files are stored and where the results will be written to.
17
18
pub const DEFAULT_DATA_DIR : & str = "." ;
@@ -209,6 +210,7 @@ async fn main() -> anyhow::Result<()> {
209
210
None
210
211
} ;
211
212
213
+ let tasks = TaskTracker :: new ( ) ;
212
214
let sim = Simulation :: new (
213
215
SimulationCfg :: new (
214
216
cli. total_time ,
@@ -219,6 +221,7 @@ async fn main() -> anyhow::Result<()> {
219
221
) ,
220
222
clients,
221
223
validated_activities,
224
+ tasks,
222
225
) ;
223
226
let sim2 = sim. clone ( ) ;
224
227
@@ -233,16 +236,18 @@ async fn main() -> anyhow::Result<()> {
233
236
}
234
237
235
238
async fn read_sim_path ( data_dir : PathBuf , sim_file : PathBuf ) -> anyhow:: Result < PathBuf > {
236
- let sim_path = if sim_file. is_relative ( ) {
237
- data_dir. join ( sim_file)
238
- } else {
239
- sim_file
240
- } ;
241
-
242
- if sim_path. exists ( ) {
243
- Ok ( sim_path)
239
+ if sim_file. exists ( ) {
240
+ Ok ( sim_file)
241
+ } else if sim_file. is_relative ( ) {
242
+ let sim_path = data_dir. join ( sim_file) ;
243
+ if sim_path. exists ( ) {
244
+ Ok ( sim_path)
245
+ } else {
246
+ log:: info!( "Simulation file '{}' does not exist." , sim_path. display( ) ) ;
247
+ select_sim_file ( data_dir) . await
248
+ }
244
249
} else {
245
- log:: info!( "Simulation file '{}' does not exist." , sim_path . display( ) ) ;
250
+ log:: info!( "Simulation file '{}' does not exist." , sim_file . display( ) ) ;
246
251
select_sim_file ( data_dir) . await
247
252
}
248
253
}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ serde_millis = "0.1.1"
32
32
rand_distr = " 0.4.3"
33
33
mockall = " 0.12.1"
34
34
rand_chacha = " 0.3.1"
35
+ tokio-util = { version = " 0.7.13" , features = [" rt" ] }
35
36
36
37
[dev-dependencies ]
37
38
ntest = " 0.9.0"
You can’t perform that action at this time.
0 commit comments