diff --git a/src/db/mod.rs b/src/db/mod.rs index dce60d19..51ffba9c 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -384,9 +384,11 @@ pub async fn backup_database(conn: &mut DbConn) -> Result { pub fn backup_sqlite_database(conn: &mut diesel::sqlite::SqliteConnection) -> Result { use diesel::RunQueryDsl; let db_url = CONFIG.database_url(); - let db_path = std::path::Path::new(&db_url).parent().unwrap().to_string_lossy(); - let file_date = chrono::Utc::now().format("%Y%m%d_%H%M%S").to_string(); - let backup_file = format!("{db_path}/db_{file_date}.sqlite3"); + let db_path = std::path::Path::new(&db_url).parent().unwrap(); + let backup_file = db_path + .join(format!("db_{}.sqlite3", chrono::Utc::now().format("%Y%m%d_%H%M%S"))) + .to_string_lossy() + .into_owned(); diesel::sql_query(format!("VACUUM INTO '{backup_file}'")).execute(conn)?; Ok(backup_file) } diff --git a/src/main.rs b/src/main.rs index 597f7ab3..6e725483 100644 --- a/src/main.rs +++ b/src/main.rs @@ -604,7 +604,7 @@ async fn launch_rocket(pool: db::DbPool, extra_debug: bool) -> Result<(), Error> tokio::spawn(async move { let mut signal_user1 = tokio::signal::unix::signal(SignalKind::user_defined1()).unwrap(); loop { - // If we need more singles to act upon, we might want to use select! here. + // If we need more signals to act upon, we might want to use select! here. // With only one item to listen for this is enough. let _ = signal_user1.recv().await; match backup_sqlite() {