Fixed bug where after_startup_fn wasn't running

This commit is contained in:
franklinblanco 2022-07-08 12:50:28 -04:00
parent bbdb0c5689
commit 9b0b80518b

View File

@ -1,6 +1,6 @@
use std::{sync::Mutex}; use std::sync::Mutex;
use actix_web::{HttpServer, App, web}; use actix_web::{HttpServer, App, web};
use crate::{r#do::shared_state::SharedStateObj}; use crate::r#do::shared_state::SharedStateObj;
use super::user_routes; use super::user_routes;
// This function is to be used in case code is meant to be run after server startup // This function is to be used in case code is meant to be run after server startup
@ -49,6 +49,6 @@ pub async fn start_all_routes(after_startup_fn_call: &dyn Fn(), state: SharedSta
// Actual server start and after startup call // Actual server start and after startup call
let (server_start_result, _after_startup_value) = let (server_start_result, _after_startup_value) =
tokio::join!(server_future, async {after_startup_fn_call}); tokio::join!(server_future, async {after_startup_fn_call()});
return server_start_result; // Return server return server_start_result; // Return server
} }