diff --git a/@xen-orchestra/fs/src/s3.js b/@xen-orchestra/fs/src/s3.js index ea1b70f0342..e020a26540e 100644 --- a/@xen-orchestra/fs/src/s3.js +++ b/@xen-orchestra/fs/src/s3.js @@ -8,6 +8,7 @@ import { decorateWith } from '@vates/decorate-with' import { parse } from 'xo-remote-parser' import RemoteHandlerAbstract from './abstract' +import { asyncEach } from '@vates/async-each' // endpoints https://docs.aws.amazon.com/general/latest/gr/s3.html @@ -177,7 +178,7 @@ export default class S3Handler extends RemoteHandlerAbstract { Delimiter: '/', // will only return path until delimiters }) - if (result.isTruncated) { + if (result.IsTruncated) { const error = new Error('more than 1000 objects, unsupported in this implementation') error.dir = dir throw error @@ -267,15 +268,21 @@ export default class S3Handler extends RemoteHandlerAbstract { Prefix: this._dir + path + '/', ContinuationToken: NextContinuationToken, }) - NextContinuationToken = result.isTruncated ? result.NextContinuationToken : undefined - for (const { Key } of result.Contents) { + NextContinuationToken = result.IsTruncated ? result.NextContinuationToken : undefined + await asyncEach( + result.Contents, + async ({Key})=>{ // _unlink will add the prefix, but Key contains everything // also we don't need to check if we delete a directory, since the list only return files - await this._s3.deleteObject({ - Bucket: this._bucket, - Key, - }) - } + await this._s3.deleteObject({ + Bucket: this._bucket, + Key, + }) + }, + { + concurrency: 16 + } + ) } while (NextContinuationToken !== undefined) } diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 2d4b163f1fc..551c0d8a3ec 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -21,6 +21,8 @@ - [Backup] Detect and clear orphan merge states, fix `ENOENT` errors (PR [#6087](https://github.com/vatesfr/xen-orchestra/pull/6087)) - [Backup] Ensure merges are also executed after backup on S3, maintaining the size of the VHD chain under control [Forum#45743](https://xcp-ng.org/forum/post/45743) (PR [#6095](https://github.com/vatesfr/xen-orchestra/pull/6095)) +- [Backup] Fix merge resuming, Introduced by 5a933bad9 (PR [#6099](https://github.com/vatesfr/xen-orchestra/pull/6099)) + ### Packages to release