fix: use single thread rt, removed tokio macros

This commit is contained in:
əlemi 2024-01-04 03:03:55 +01:00
parent beb80cc183
commit 952279f0a8
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 10 additions and 4 deletions

View file

@ -26,7 +26,7 @@ serde-inline-default = "0.1" # TODO this hopefully won't be needed anymore soon
async-trait = "0.1"
html-escape = "0.2"
clap = { version = "4.4", features = ["derive", "cargo"] }
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.35" }
axum = "0.7"
# db providers
sqlx = { version = "0.7", features = ["runtime-tokio", "tls-rustls", "any"] }

View file

@ -58,8 +58,7 @@ enum CliAction {
},
}
#[tokio::main]
async fn main() {
async fn launch() {
let args = CliArgs::parse();
tracing_subscriber::fmt::fmt()
@ -160,6 +159,14 @@ async fn main() {
}
}
fn main() {
tokio::runtime::Builder::new_current_thread()
.build().expect("could not create tokio runtime")
.block_on(async {
launch().await
});
}
// it drives me nuts that it doesn't do it by default!!! is there an option?
fn if_using_sqlite_driver_and_file_is_missing_create_it_beforehand(uri: &str) {
use std::str::FromStr;
@ -172,5 +179,4 @@ fn if_using_sqlite_driver_and_file_is_missing_create_it_beforehand(uri: &str) {
}
}
}
}