This commit is contained in:
Untone 2023-10-11 18:02:49 +03:00
parent 6c659e1c8e
commit f931a9288e

View File

@ -10,13 +10,6 @@ use tokio::task::JoinHandle;
mod data;
macro_rules! log {
($($arg:tt)*) => {{
let timestamp = Local::now().format("%Y-%m-%d %H:%M:%S%.3f");
println!("[{}] {}", timestamp, format_args!($($arg)*));
}};
}
#[derive(Clone)]
struct AppState {
tasks: Arc<Mutex<HashMap<String, JoinHandle<()>>>>,
@ -122,9 +115,9 @@ async fn main() -> std::io::Result<()> {
tasks: tasks.clone(),
redis: client.clone(),
};
log!("Redis client initialized");
println!("Redis client initialized");
HttpServer::new(move || {
log!("Webserver initialized");
println!("Webserver initialized");
App::new()
.app_data(web::Data::new(state.clone()))
.route("/", web::get().to(connect_handler))