runBackup rejects a contentConcurrency that is not a positive integer
check / check (push) Waiting to run

A library object whose contentConcurrency was missing, 0 or negative
started no worker, so the backup stored no original, dropped the earlier
entries of failures.json and reported no error. runBackup now throws a
RangeError for any limit that is not a positive integer, as BoundedPool
does, before it takes the lock.

Model: opus-5-5
This commit is contained in:
2026-10-14 05:18:34 +00:00
parent 115357ce97
commit 558ce6052c
+8
View File
@@ -933,6 +933,14 @@ export const runBackup = async (
"open the library with one)",
);
}
// As `BoundedPool` does. A limit below 1, or one that is not a number,
// would back up no original and end with no error.
const { contentConcurrency } = lib;
if (!Number.isInteger(contentConcurrency) || contentConcurrency < 1) {
throw new RangeError(
`contentConcurrency must be a positive integer, got ${contentConcurrency}`,
);
}
if (opts.lockHeld) {
return runLockedBackup(lib, opts, downloadDirectory);
}