diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs index ab5db5d..3b8c2af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,12 +5,9 @@ #![feature(box_patterns)] #![allow(deprecated)] -use std::{ - thread, - time::{ - Duration, - Instant, - }, +use std::time::{ + Duration, + Instant, }; use log::{ @@ -39,7 +36,6 @@ mod game { } } -mod audio; mod bot; mod commands; mod config; @@ -55,7 +51,8 @@ const BACKOFF_INIT: f64 = 100.0; const MIN_RUN_DURATION: Duration = Duration::from_secs(120); -fn main() { +#[tokio::main] +async fn main() { log_setup::init(false).expect("initializing logging"); let mut backoff_count: usize = 0; @@ -64,13 +61,13 @@ fn main() { let start = Instant::now(); info!("starting bot"); - match bot::run() { + match bot::run().await { Err(e) => { error!("error encountered running client: {:?}", e); }, _ => { // NOTE: we MUST have gotten here through SIGINT/SIGTERM handlers - ::std::process::exit(0); + std::process::exit(0); }, } @@ -87,6 +84,6 @@ fn main() { let backoff_millis = (BACKOFF_INIT * BACKOFF_FACTOR.powi(backoff_count as i32)) as u64; info!("bot died too quickly. backing off, retrying in {}ms.", backoff_millis); - thread::sleep(Duration::from_millis(backoff_millis)); + tokio::time::sleep(Duration::from_millis(backoff_millis)).await; } } |
