Limited Parallel Execution and the TaskQueue class
Explore how to implement limited parallel execution in Node.js by using the TaskQueue class. Understand how to manage concurrency with promises to control asynchronous task flow effectively.
We'll cover the following...
So far, promises haven’t disappointed our expectations. We were able to greatly improve our code for both serial and parallel execution. Now, with limited parallel execution, things should not be that different, considering that this flow is just a combination of serial and parallel execution.
In this section, we’ll go straight to implementing a solution that allows us to globally limit the concurrency of our web spider tasks. In other words, we’re going to implement our solution in a class that we can use to instantiate objects that we can pass around to different functions of the same application. If we’re just interested in a simple solution to locally ...