Skip to content

Commit 393f691

Browse files
ranjan-purbeyaddaleax
authored andcommitted
doc: improve worker pool example
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]>
1 parent a9b8f70 commit 393f691

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

doc/api/async_hooks.md

+1
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ class WorkerPool extends EventEmitter {
820820
});
821821
this.workers.push(worker);
822822
this.freeWorkers.push(worker);
823+
this.emit(kWorkerFreedEvent);
823824
}
824825

825826
runTask(task, callback) {

0 commit comments

Comments
 (0)