mirror of
https://github.com/Dangoware/confetti-box.git
synced 2025-04-19 23:32:58 -05:00
Minor tweaks
This commit is contained in:
parent
4ff2d2496d
commit
80a4c767a8
2 changed files with 4 additions and 2 deletions
|
@ -42,7 +42,7 @@ impl Database {
|
||||||
let mut out_path = self.path.clone();
|
let mut out_path = self.path.clone();
|
||||||
out_path.set_extension(".bkp");
|
out_path.set_extension(".bkp");
|
||||||
let mut file = File::create(&out_path).expect("Could not save!");
|
let mut file = File::create(&out_path).expect("Could not save!");
|
||||||
encode_into_std_write(&self, &mut file, BINCODE_CFG).expect("Could not write out!");
|
encode_into_std_write(self, &mut file, BINCODE_CFG).expect("Could not write out!");
|
||||||
|
|
||||||
fs::rename(out_path, &self.path).unwrap();
|
fs::rename(out_path, &self.path).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,8 @@ fn clean_database(db: &Arc<RwLock<Database>>) {
|
||||||
debug!("Deleted file: {}", file.1.name());
|
debug!("Deleted file: {}", file.1.name());
|
||||||
database.files.remove(&file.0);
|
database.files.remove(&file.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
database.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rocket::main]
|
#[rocket::main]
|
||||||
|
@ -165,7 +167,7 @@ async fn main() {
|
||||||
let (shutdown, mut rx) = tokio::sync::mpsc::channel(1);
|
let (shutdown, mut rx) = tokio::sync::mpsc::channel(1);
|
||||||
let cleaner_db = database.clone();
|
let cleaner_db = database.clone();
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
let mut interval = time::interval(Duration::from_secs(60));
|
let mut interval = time::interval(Duration::from_secs(120));
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
select! {
|
select! {
|
||||||
|
|
Loading…
Reference in a new issue