add async feature #1
@ -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>) {
|
||||
|
Loading…
Reference in New Issue
Block a user