L
L
LionG2020-07-13 19:29:27
Node.js
LionG, 2020-07-13 19:29:27

What is the easiest way to manage a queue of promises (no more than N running at the same time)?

There is an array of data, there is a function that returns a Promise to which you need to send this data in turn, and there is a limit of no more than N simultaneously working promises.

I wrote a class for this task and everything works successfully. Upload to npm or am I reinventing the wheel? Maybe there are other solutions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Loli E1ON, 2020-07-14
@LionG

https://www.npmjs.com/package/p-limit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question