Limited Parallel Execution and the TaskQueue class
Learn limited parallel execution and implement it using the TaskQueue class.
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 limit the parallel execution of a set of tasks, we can still apply the same principles that we’ll see in this section to implement a special asynchronous version of the Array.map()
method.
Get hands-on with 1400+ tech skills courses.