remove extra async calls

main
Zynh0722 2023-11-03 05:33:41 -07:00
parent e3007c3e49
commit ab2c1bb677
1 changed files with 4 additions and 5 deletions

View File

@ -34,7 +34,7 @@ use crate::templates::shift_reports_html;
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
async fn establish_connection() -> Pool<AsyncMysqlConnection> {
fn establish_connection() -> Pool<AsyncMysqlConnection> {
dotenv().ok();
let database_url = std::env::var("DATABASE_URL").expect("You must set DATABASE_URL");
@ -47,14 +47,13 @@ async fn establish_connection() -> Pool<AsyncMysqlConnection> {
#[derive(Clone)]
pub(crate) struct AppState {
#[allow(dead_code)]
connection: Pool<AsyncMysqlConnection>,
}
impl AppState {
async fn init() -> Self {
fn init() -> Self {
Self {
connection: establish_connection().await,
connection: establish_connection(),
}
}
}
@ -70,7 +69,7 @@ async fn main() {
.with(tracing_subscriber::fmt::layer())
.init();
let state = AppState::init().await;
let state = AppState::init();
let fallback_handler = ServeDir::new("dist").not_found_service(ServeFile::new("dist/404.html"));