@xen-orchestra/backups 0.29.2 → 0.29.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/RemoteAdapter.js +20 -18
  2. package/package.json +1 -1
package/RemoteAdapter.js CHANGED
@@ -232,21 +232,23 @@ class RemoteAdapter {
232
232
  return promise
233
233
  }
234
234
 
235
- #removeVmBackupsFromCache(backups) {
236
- for (const [dir, filenames] of Object.entries(
237
- groupBy(
238
- backups.map(_ => _._filename),
239
- dirname
240
- )
241
- )) {
242
- // detached async action, will not reject
243
- this._updateCache(dir + '/cache.json.gz', backups => {
244
- for (const filename of filenames) {
245
- debug('removing cache entry', { entry: filename })
246
- delete backups[filename]
247
- }
248
- })
249
- }
235
+ async #removeVmBackupsFromCache(backups) {
236
+ await asyncEach(
237
+ Object.entries(
238
+ groupBy(
239
+ backups.map(_ => _._filename),
240
+ dirname
241
+ )
242
+ ),
243
+ ([dir, filenames]) =>
244
+ // will not reject
245
+ this._updateCache(dir + '/cache.json.gz', backups => {
246
+ for (const filename of filenames) {
247
+ debug('removing cache entry', { entry: filename })
248
+ delete backups[filename]
249
+ }
250
+ })
251
+ )
250
252
  }
251
253
 
252
254
  async deleteDeltaVmBackups(backups) {
@@ -255,7 +257,7 @@ class RemoteAdapter {
255
257
  // this will delete the json, unused VHDs will be detected by `cleanVm`
256
258
  await asyncMapSettled(backups, ({ _filename }) => handler.unlink(_filename))
257
259
 
258
- this.#removeVmBackupsFromCache(backups)
260
+ await this.#removeVmBackupsFromCache(backups)
259
261
  }
260
262
 
261
263
  async deleteMetadataBackup(backupId) {
@@ -284,7 +286,7 @@ class RemoteAdapter {
284
286
  Promise.all([handler.unlink(_filename), handler.unlink(resolveRelativeFromFile(_filename, xva))])
285
287
  )
286
288
 
287
- this.#removeVmBackupsFromCache(backups)
289
+ await this.#removeVmBackupsFromCache(backups)
288
290
  }
289
291
 
290
292
  deleteVmBackup(file) {
@@ -641,7 +643,7 @@ class RemoteAdapter {
641
643
  })
642
644
 
643
645
  // will not throw
644
- this._updateCache(this.#getVmBackupsCache(vmUuid), backups => {
646
+ await this._updateCache(this.#getVmBackupsCache(vmUuid), backups => {
645
647
  debug('adding cache entry', { entry: path })
646
648
  backups[path] = {
647
649
  ...metadata,
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/vatesfr/xen-orchestra.git"
10
10
  },
11
- "version": "0.29.2",
11
+ "version": "0.29.3",
12
12
  "engines": {
13
13
  "node": ">=14.6"
14
14
  },