The import service currently processes records serially. Implement mapLimit(items, limit, worker) so it:
- runs at most
limit workers at once;
- preserves input order in the returned results;
- supports synchronous or asynchronous workers;
- stops scheduling new items after the first rejection and rejects with that error;
- rejects invalid limits instead of silently hanging.
Do not solve this by launching every promise up front—the production input can contain millions of records.