Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Try to run recursiveDelete in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGresse committed Apr 2, 2024
1 parent b4972fd commit aba1569
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/openplanner/getSpeakersSessionsSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const getSpeakersSessionsSchedule = async (payload: {
return 1
}
if (bDate && isNaN(bDate.getTime()) ) {
console.warn("Invalid date", b.id, a.title)
console.warn("Invalid date", b.id, b.title)
return -1
}

Expand Down
11 changes: 8 additions & 3 deletions scripts/openplanner/runInParallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export const runInParallel = async <T, R>(
while (queue.length > 0) {
const dataIndex = dataList.length - queue.length;
const dataEl = queue.shift();

console.log(`Running ${index} for ${dataIndex}`);

try {
results[dataIndex] = await runFunction(dataEl);
} catch (error) {
Expand All @@ -33,6 +30,14 @@ export const runInParallel = async <T, R>(
};

const parallelRequests = Math.min(numberOfParallelRequest, dataList.length);
console.log(`Running ${parallelRequests} parallel requests`);

if(parallelRequests === 0) {
resolve([]);
console.log('No parallel requests to run');
return;
}

for (let i = 0; i < parallelRequests; i++) {
processNext(i).catch(reject);
}
Expand Down

0 comments on commit aba1569

Please sign in to comment.