Skip to content

Instantly share code, notes, and snippets.

@exhesham
Created December 12, 2021 08:19
Show Gist options
  • Save exhesham/79322745fde2fcea5a589deaa9954ba9 to your computer and use it in GitHub Desktop.
Save exhesham/79322745fde2fcea5a589deaa9954ba9 to your computer and use it in GitHub Desktop.
sol1.ts
async function solution1() {
for(let i = 0; i < tasksSleepInput.length; i+= chunkSize) {
let batch = tasksSleepInput.slice(i, i + chunkSize);
console.log(`* start running batch ${i}`);
await Promise.all(batch.map(taskExecutor));
console.log(`* finished running batch ${i}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment