summaryrefslogtreecommitdiff
path: root/doc/api/async_hooks.md
diff options
context:
space:
mode:
authorRanjan Purbey <ranjan.purbey@gmail.com>2020-04-27 04:13:57 +0530
committerAnna Henningsen <anna@addaleax.net>2020-04-29 05:10:22 +0200
commit393f6914df3431b194f49fbb4fb9ee2430f8807c (patch)
treec38d9c651fc787499e544cafaf49d9f35b06f03e /doc/api/async_hooks.md
parenta9b8f707662d4c564f4439b150229635da007ae7 (diff)
downloadnode-new-393f6914df3431b194f49fbb4fb9ee2430f8807c.tar.gz
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'doc/api/async_hooks.md')
-rw-r--r--doc/api/async_hooks.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index 5463c39bdc..0b1b22c829 100644
--- a/doc/api/async_hooks.md
+++ b/doc/api/async_hooks.md
@@ -820,6 +820,7 @@ class WorkerPool extends EventEmitter {
});
this.workers.push(worker);
this.freeWorkers.push(worker);
+ this.emit(kWorkerFreedEvent);
}
runTask(task, callback) {