jetstream::JetstreamClient,
let from = Arc::new(Db::new(".fjall_data_from").expect("couldnt create db"));
let to = Arc::new(Db::new(".fjall_data_to").expect("couldnt create db"));
150
-
let mut threads = Vec::new();
151
-
for nsid in from.get_nsids() {
151
+
let nsids = from.get_nsids().collect::<Vec<_>>();
152
+
let mut threads = Vec::with_capacity(nsids.len());
threads.push(std::thread::spawn(move || {
let mut total_count = 0_u64;
174
-
total_count += thread.join().expect("thread panicked");
176
+
let count = thread.join().expect("thread panicked");
179
+
let read_time = start.elapsed();
180
+
let read_per_second = total_count as f64 / read_time.as_secs_f64();
to.sync(true).expect("cant sync");
177
-
tracing::info!("migrated {total_count} events!");
182
+
let total_time = start.elapsed();
183
+
let write_per_second = total_count as f64 / (total_time - read_time).as_secs_f64();
185
+
"migrated {total_count} events in {total_time:?} ({read_per_second:.2} rps, {write_per_second:.2} wps)"