mirror of
https://git.alemi.dev/guestbook.rs.git
synced 2024-12-19 02:54:52 +01:00
fix: use single thread rt, removed tokio macros
This commit is contained in:
parent
beb80cc183
commit
952279f0a8
2 changed files with 10 additions and 4 deletions
|
@ -26,7 +26,7 @@ serde-inline-default = "0.1" # TODO this hopefully won't be needed anymore soon
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
html-escape = "0.2"
|
html-escape = "0.2"
|
||||||
clap = { version = "4.4", features = ["derive", "cargo"] }
|
clap = { version = "4.4", features = ["derive", "cargo"] }
|
||||||
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.35" }
|
||||||
axum = "0.7"
|
axum = "0.7"
|
||||||
# db providers
|
# db providers
|
||||||
sqlx = { version = "0.7", features = ["runtime-tokio", "tls-rustls", "any"] }
|
sqlx = { version = "0.7", features = ["runtime-tokio", "tls-rustls", "any"] }
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -58,8 +58,7 @@ enum CliAction {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
async fn launch() {
|
||||||
async fn main() {
|
|
||||||
let args = CliArgs::parse();
|
let args = CliArgs::parse();
|
||||||
|
|
||||||
tracing_subscriber::fmt::fmt()
|
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?
|
// 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) {
|
fn if_using_sqlite_driver_and_file_is_missing_create_it_beforehand(uri: &str) {
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -172,5 +179,4 @@ fn if_using_sqlite_driver_and_file_is_missing_create_it_beforehand(uri: &str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue