From the course: Advanced Node.js
Unlock the full course today
Join today to access over 23,500 courses taught by industry experts.
Concurrent tasks - Node.js Tutorial
From the course: Advanced Node.js
Concurrent tasks
- [Instructor] So so far we've looked at a couple of ways to execute asynchronous tasks sequentially. We also looked at a way that we can execute asynchronous task as promises in parallel. But what happens if we want to combine both sequential and parallel operations? Sometimes your promises may contain large tasks that eat a lot of resources or take a lot of time to process. Running everything at once can be too costly, but running one task at a time may take too long. A possible solution for this is to create a task queue that can run a specified number of tasks concurrently at the same time. Let's implement a promise queue that can run a specified number of promises at the same time. For this example I'm inside of our exercise files under chapter one, chapter one, less eight and within the start folder you'll see that we have the delay promise that we created that will create a promise that will delay for a specified number of seconds. So here we have a list of tasks and we'reâ¦
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Callback pattern8m
-
(Locked)
Resolving promises5m 40s
-
(Locked)
Rejecting promises2m 58s
-
(Locked)
The promisify function5m 18s
-
(Locked)
Sequential execution7m 6s
-
(Locked)
Sequential execution with async/await7m
-
(Locked)
Parallel execution4m 6s
-
(Locked)
Concurrent tasks6m 3s
-
(Locked)
Logging concurrent tasks3m 3s
-
-
-
-