diff --git a/src/main.rs b/src/main.rs index c927639..7e058e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,13 +102,9 @@ fn db_writer_task(rx: mpsc::Receiver) { let storage = Storage::new(DB_DIR, options).unwrap(); let collection = storage.collection("questions").unwrap(); - let mut count: usize = 0; - rx.into_iter().for_each(|question| { - collection.insert(question).expect("insert question"); - count += 1; - }); + let count = collection.load(rx).expect("load"); - println!("inserted {count}"); + println!("loaded {count}"); println!("syncing to disk..."); storage.sync(true).unwrap();