diff --git a/src/main.rs b/src/main.rs index 2add117..1cf8ba4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -263,6 +263,8 @@ async fn data_reader(queue: WriteQueue) { } // mark queue as done for writer to exit loop queue.lock().await.push_back(None); + + println!("convert done ✅"); } async fn data_writer(queue: WriteQueue) { @@ -303,6 +305,8 @@ async fn data_writer(queue: WriteQueue) { } } writer.close().await.unwrap(); + + println!("write done ✅"); } #[tokio::main] @@ -313,17 +317,15 @@ async fn main() -> Result<(), Box> { _ => (), }; - let queue: WriteQueue = Arc::new(Mutex::new(VecDeque::with_capacity(40))); + let queue: WriteQueue = Arc::new(Mutex::new(VecDeque::with_capacity(5000))); let queue_r = Arc::clone(&queue); let queue_w = Arc::clone(&queue); - let res = tokio::try_join!( - tokio::spawn(async move { data_reader(queue_r).await }), - tokio::spawn(async move { data_writer(queue_w).await }) - ); + tokio::try_join!( + tokio::spawn(data_reader(queue_r)), + tokio::spawn(data_writer(queue_w)) + )?; - res?; - - println!("done ✅"); + println!("all done ✅"); Ok(()) }