Only save database on clean and shutdown

This commit is contained in:
G2-Games 2024-10-28 03:30:36 -05:00
parent 8de33459eb
commit 0f780d027d
2 changed files with 1 additions and 1 deletions

View file

@ -245,6 +245,7 @@ fn clean_database(db: &Arc<RwLock<Database>>, file_path: &Path) {
info!("Cleaned database. Removed {removed_entries} expired entries. Removed {removed_files} no longer referenced files.");
database.save();
drop(database); // Just to be sure
}
/// A loop to clean the database periodically.

View file

@ -147,7 +147,6 @@ async fn handle_upload(
std::fs::rename(temp_filename, settings.file_dir.join(file_hash.to_string()))?;
db.write().unwrap().insert(&file_mmid, constructed_file.clone());
db.write().unwrap().save();
Ok(Json(ClientResponse {
status: true,