Some tasks can easily be split
$ npm i parallel-workers-manager
import { ParallelWorkersManager } from 'parallel-workers-manager';
const manager = new ParallelWorkersManager(
(value) => {
return value;
},
{
maxWorkers: 1,
},
);
const promises = [manager.post('abc'), manager.post('def')];
const results = await Promise.all(promises);
expect(results).toEqual(['abc', 'def']);