Skip to content

Commit

Permalink
doc: improve worker pool example
Browse files Browse the repository at this point in the history
In the worker pool example, the 'kWorkerFreedEvent' should be emitted
in case of error as well. After adding new worker in the error handler,
the pending tasks should be notified of an available worker.

PR-URL: #33082
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
  • Loading branch information
ranjan-purbey authored and targos committed May 4, 2020
1 parent 289a5c8 commit de15edc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ class WorkerPool extends EventEmitter {
});
this.workers.push(worker);
this.freeWorkers.push(worker);
this.emit(kWorkerFreedEvent);
}

runTask(task, callback) {
Expand Down

0 comments on commit de15edc

Please sign in to comment.