feat(backups/RemoteAdapter#cleanVm): configurable merge limiter

This commit is contained in:
Julien Fontanet 2021-10-12 09:17:42 +02:00
parent abcabb736b
commit 9c83e70a28
2 changed files with 9 additions and 3 deletions

View File

@ -11,7 +11,7 @@ const { limitConcurrency } = require('limit-concurrency-decorator')
// //
// the whole chain will be merged into parent, parent will be renamed to child // the whole chain will be merged into parent, parent will be renamed to child
// and all the others will deleted // and all the others will deleted
const mergeVhdChain = limitConcurrency(1)(async function mergeVhdChain(chain, { handler, onLog, remove, merge }) { async function mergeVhdChain(chain, { handler, onLog, remove, merge }) {
assert(chain.length >= 2) assert(chain.length >= 2)
let child = chain[0] let child = chain[0]
@ -73,7 +73,7 @@ const mergeVhdChain = limitConcurrency(1)(async function mergeVhdChain(chain, {
}), }),
]) ])
} }
}) }
const noop = Function.prototype const noop = Function.prototype
@ -114,7 +114,12 @@ const listVhds = async (handler, vmDir) => {
return { vhds, interruptedVhds } return { vhds, interruptedVhds }
} }
exports.cleanVm = async function cleanVm(vmDir, { fixMetadata, remove, merge, onLog = noop }) { const defaultMergeLimiter = limitConcurrency(1)
exports.cleanVm = async function cleanVm(
vmDir,
{ fixMetadata, remove, merge, mergeLimiter = defaultMergeLimiter, onLog = noop }
) {
const handler = this._handler const handler = this._handler
const vhds = new Set() const vhds = new Set()

View File

@ -30,6 +30,7 @@
> >
> In case of conflict, the highest (lowest in previous list) `$version` wins. > In case of conflict, the highest (lowest in previous list) `$version` wins.
- @xen-orchestra/backups minor
- @xen-orchestra/proxy minor - @xen-orchestra/proxy minor
- xo-server patch - xo-server patch
- xo-web minor - xo-web minor