snapshot at start

This commit is contained in:
many 2020-10-15 16:11:02 +02:00
parent 1eace79f77
commit 10dace305d
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA

View File

@ -45,10 +45,10 @@ pub fn schedule_snapshot(data: Data, snapshot_dir: &Path, time_gap_s: u64) -> Re
let snapshot_path = snapshot_dir.join(format!("{}.snapshot", db_name.to_str().unwrap_or("data.ms"))); let snapshot_path = snapshot_dir.join(format!("{}.snapshot", db_name.to_str().unwrap_or("data.ms")));
thread::spawn(move || loop { thread::spawn(move || loop {
thread::sleep(Duration::from_secs(time_gap_s));
if let Err(e) = create_snapshot(&data, &snapshot_path) { if let Err(e) = create_snapshot(&data, &snapshot_path) {
error!("Unsuccessful snapshot creation: {}", e); error!("Unsuccessful snapshot creation: {}", e);
} }
thread::sleep(Duration::from_secs(time_gap_s));
}); });
Ok(()) Ok(())