From 0099f68809c5b3b474bc0e883ca938558320233c Mon Sep 17 00:00:00 2001 From: vimwitch Date: Fri, 29 Nov 2024 11:15:20 -0800 Subject: [PATCH] feat: create snapshot every 30 minutes --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 20a6d90c..65157d3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,13 @@ async fn main() -> Result<(), AppError> { // only create snapshot in release mode #[cfg(not(debug_assertions))] - create_snapshot(&DB); + tokio::spawn(async move { + loop { + create_snapshot(&DB); + // snapshot every 30 mins + sleep_seconds(1800).await; + } + }); tokio::spawn(async move { loop {