Run promise tasks with bounded concurrency
Given a list of async tasks (functions returning promises) and a limit k, run them with at most k in flight at once, start the next as soon as one finishes, and resolve with all results in the original order. Decide what happens when a task rejects.
No answer yet. Write the first one; the best answer gets endorsed.