Use tokio::time::delay_for in lieu of thread::sleep.

This commit is contained in:
Tim Kuehn
2019-12-07 21:28:45 -08:00
parent bbbd43e282
commit 917c0c5e2d

View File

@@ -16,7 +16,6 @@ use std::{
net::SocketAddr, net::SocketAddr,
pin::Pin, pin::Pin,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
thread,
time::Duration, time::Duration,
}; };
use subscriber::Subscriber as _; use subscriber::Subscriber as _;
@@ -188,7 +187,8 @@ async fn main() -> io::Result<()> {
.broadcast(context::current(), "hi again".to_string()) .broadcast(context::current(), "hi again".to_string())
.await?; .await?;
thread::sleep(Duration::from_millis(100)); tokio::time::delay_for(Duration::from_millis(100)).await;
println!("Done.");
Ok(()) Ok(())
} }