From 659f00a2c217cd25148dc54f5b19ca57986aeaf1 Mon Sep 17 00:00:00 2001 From: Yjn024 Date: Thu, 7 Dec 2023 14:19:13 +0800 Subject: [PATCH] daemons --- src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2ed031f..9051dad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{path::PathBuf, sync::Arc}; +use std::{path::PathBuf, sync::Arc, time::Duration}; use axum::{ routing::{get, post}, @@ -105,7 +105,16 @@ async fn main() { &format!("/{}/{}", config.mng_secret, config.mng_reject_papers_secret), post(paper::reject::), ) - .with_state(state); + .with_state(state.clone()); + + tokio::spawn(dmds_tokio_fs::daemon( + state.papers.clone(), + Duration::from_secs(45), + )); + tokio::spawn(dmds_tokio_fs::daemon( + state.questions.clone(), + Duration::from_secs(120), + )); axum::serve( tokio::net::TcpListener::bind(format!("127.0.0.1:{port}"))