format code

This commit is contained in:
mpostma 2021-03-24 11:29:11 +01:00
parent 1f16c8d224
commit 4041d9dc48
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
18 changed files with 60 additions and 61 deletions

View file

@ -39,7 +39,10 @@ where
}
pub async fn run(self) {
info!("Snashot scheduled every {}s.", self.snapshot_period.as_secs());
info!(
"Snashot scheduled every {}s.",
self.snapshot_period.as_secs()
);
loop {
sleep(self.snapshot_period).await;
if let Err(e) = self.perform_snapshot().await {
@ -49,17 +52,11 @@ where
}
async fn perform_snapshot(&self) -> anyhow::Result<()> {
if !self.snapshot_path.is_file() {
bail!("Invalid snapshot file path.");
}
info!("Performing snapshot.");
let temp_snapshot_dir = spawn_blocking(move || tempfile::tempdir_in(".")).await??;
let temp_snapshot_path = temp_snapshot_dir.path().to_owned();
fs::create_dir_all(&temp_snapshot_path).await?;
let uuids = self
.uuid_resolver_handle
.snapshot(temp_snapshot_path.clone())