fix(sonar): move default out of runPool parameter list (javascript:S1788)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-10-06 12:00:33 +02:00
parent e81ebbc45b
commit 8f856c8f8b

View File

@ -358,9 +358,9 @@ function ttvcIsLowMemoryDevice() {
window.ttvcIsLowMemoryDevice = ttvcIsLowMemoryDevice;
// Run an async worker over items with bounded concurrency (default 4). `onProgress(done,total)`
// fires after each item. Replaces slow serial `for…await` loops over network calls.
async function runPool(items, worker, concurrency = 4, onProgress) {
async function runPool(items, worker, concurrency, onProgress) {
const arr = [...items]; let i = 0, done = 0; const total = arr.length;
const requested = Math.max(1, Number(concurrency) || 1);
const requested = Math.max(1, Number(concurrency ?? 4) || 1);
const effectiveConcurrency = ttvcIsLowMemoryDevice() ? Math.min(2, requested) : requested;
async function run() {
while (i < arr.length) {