mirror of
https://github.com/Dangoware/confetti-box.git
synced 2025-04-19 15:22:57 -05:00
Only save database on clean and shutdown
This commit is contained in:
parent
8de33459eb
commit
0f780d027d
2 changed files with 1 additions and 1 deletions
|
@ -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.");
|
info!("Cleaned database. Removed {removed_entries} expired entries. Removed {removed_files} no longer referenced files.");
|
||||||
|
|
||||||
database.save();
|
database.save();
|
||||||
|
drop(database); // Just to be sure
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A loop to clean the database periodically.
|
/// A loop to clean the database periodically.
|
||||||
|
|
|
@ -147,7 +147,6 @@ async fn handle_upload(
|
||||||
std::fs::rename(temp_filename, settings.file_dir.join(file_hash.to_string()))?;
|
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().insert(&file_mmid, constructed_file.clone());
|
||||||
db.write().unwrap().save();
|
|
||||||
|
|
||||||
Ok(Json(ClientResponse {
|
Ok(Json(ClientResponse {
|
||||||
status: true,
|
status: true,
|
||||||
|
|
Loading…
Reference in a new issue