Subscribe free
Morning Merge JavaScript · Friday, November 20, 20262 min read

Cap concurrency before Promise.all

Also: 30-minute Lambda jobs, Vue 3.5.46, and browser-made zines

If your JavaScript batch job fires a request for every record, check how many can run at once. Cap concurrency before the requests start, not at Promise.all.

The main thing

A gripper lowers a gold block into an empty feeder slot.

Put a cap on requests before Promise.all. A November 19, 2026 write-up on DEV shows how a worker pool can keep a JavaScript batch job from swamping a downstream API or database pool. Start with any job that passes a growing list to Promise.all.

The important part of Promise.all(ids.map(fetchUser)) happens inside the parentheses. The map calls fetchUser for every ID before Promise.all gets the array of promises. Promise.all waits for the requests; it doesn't get a chance to decide when they start.

Fixed-size batches set a cap, but every batch waits for its slowest request. A worker pool lets each worker grab the next record as soon as it finishes one. In the author's simulation, the service rejected requests above 10 concurrent connections, and the capped pool completed all 200 requests.

The cap answers how much work to start. You still need to decide what happens when one request fails. A rejection from Promise.all doesn't cancel the other requests, so don't take a failed batch as proof that nothing was written.

If a failure should stop the job, stop taking new records and pass an abort signal to work that supports it. If the records are independent, let the workers keep going and record the failures for retry. Either way, test the job with enough records to fill every slot.

At runtime

A gold segment extends a mechanical timer’s curved track.

On-demand Lambda Event Functions can run for 30 minutes. AWS doubled the old 15-minute limit for synchronous, asynchronous and event-source mapping invocations. If you split a Node.js worker only to stay within the old limit, check whether you still need the split. For synchronous calls, check the caller's timeout before raising yours.

Vue 3.5.46 is out.

In the browser

A scored gold sheet bends in a bookbinding jig.

An eight-page zine from one A4 sheet. The browser-based project is a nice test case for any print feature: you read the pages in a different order than you lay them out on the sheet. Try folding a copy before you assume the browser preview tells the whole story.

← All Morning Merge JavaScript issues

Get this in your inbox every morning.

Free. Five minutes. Unsubscribe in one click.

Subscribe free →