fix write_db tokio join

This commit is contained in:
Dmitry Belyaev 2023-08-08 16:50:02 +03:00
parent 8306c76a0c
commit 2c3950ccfc
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3
1 changed files with 4 additions and 2 deletions

View File

@ -170,8 +170,10 @@ async fn read_from_db(id: u32) -> Option<Question> {
}
async fn write_db() {
let (tx, rx) = mpsc::unbounded_channel::<Question>();
let (r, _) = tokio::join!(tokio::spawn(zip_reader_task(tx)), db_writer_task(rx),);
r.expect("tokio join");
tokio::try_join!(
tokio::spawn(zip_reader_task(tx)),
tokio::spawn(db_writer_task(rx))
).expect("tokio join");
println!("all done");
}
async fn db_writer_task(rx: UnboundedReceiver<Question>) {