Bound parallelism
Use a bounded client-side queue and send each job through an ordinary compatible request. This controls load without assuming a server batch endpoint.
A service batch mode is a separate API contract: use its route and body only after it is published in account settings or the specification.
Client-controlled bounded parallelism
typescript
async function runWithLimit(items, limit, work) {
const results = [];
for (let offset = 0; offset < items.length; offset += limit) {
const group = items.slice(offset, offset + limit);
results.push(...await Promise.all(group.map(work)));
}
return results;
}Control the queue
- Make an internal job id deterministic and unique within a run.
- Split an oversized set into manageable groups.
- Keep failure of one item distinct from failure of the whole queue.
Collect results
Join a result to an internal id and retain the status of every job.
Do not automatically retry all jobs: retry only transient failures after checking idempotency.