create indexes snapshots concurrently

This commit is contained in:
mpostma 2021-03-22 19:59:19 +01:00
parent e9da191b7d
commit 1f51fc8baf
No known key found for this signature in database
GPG Key ID: CBC8A7C1D7A28C3A
1 changed files with 6 additions and 3 deletions

View File

@ -64,9 +64,12 @@ impl<B> SnapshotService<B> {
return Ok(())
}
for uuid in uuids {
self.update_handle.snapshot(uuid, temp_snapshot_path.clone()).await?;
}
let tasks = uuids
.iter()
.map(|&uuid| self.update_handle.snapshot(uuid, temp_snapshot_path.clone()))
.collect::<Vec<_>>();
futures::future::try_join_all(tasks).await?;
let temp_snapshot_file = temp_snapshot_path.with_extension("temp");