Run fn through the process-wide queue.
fn
Sugar for getDefaultQueue. Pass concurrency once, or on every call — the same value reuses the same queue, so the cap is actually enforced:
concurrency
// Set it once at startup:getDefaultQueue({ concurrency: 4 });// or per call, with the same value:await queued(() => transcode(a));await queued(() => transcode(b)); Copy
// Set it once at startup:getDefaultQueue({ concurrency: 4 });// or per call, with the same value:await queued(() => transcode(a));await queued(() => transcode(b));
Run
fnthrough the process-wide queue.Sugar for getDefaultQueue. Pass
concurrencyonce, or on every call — the same value reuses the same queue, so the cap is actually enforced: