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 <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
  • Loading branch information
ranjan-purbey authored and addaleax committed Apr 29, 2020
1 parent a9b8f70 commit 393f691
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 393f691

Please sign in to comment.