feat(backups/deleteVmBackups): run cleanVm in parallel

This commit is contained in:
Julien Fontanet 2022-09-12 11:20:26 +02:00
parent 4350f0cd1a
commit 9d09a3adf5

View File

@ -298,14 +298,13 @@ class RemoteAdapter {
full !== undefined && this.deleteFullVmBackups(full),
])
const dirs = new Set(files.map(file => dirname(file)))
for (const dir of dirs) {
await asyncMap(new Set(files.map(file => dirname(file))), dir =>
// - don't merge in main process, unused VHDs will be merged in the next backup run
// - don't error in case this fails:
// - if lock is already being held, a backup is running and cleanVm will be ran at the end
// - otherwise, there is nothing more we can do, orphan file will be cleaned in the future
await this.cleanVm(dir, { remove: true, logWarn: warn }).catch(noop)
}
this.cleanVm(dir, { remove: true, logWarn: warn }).catch(noop)
)
}
#getCompressionType() {