toor makes it easy to take a worker out of rotation.
When using cluster, it's easy enough to take a worker out of rotation from
inside the worker. Just
close() the server, and then call
when you want to bring it back again.
In many cases, it's more logical to control which workers are in rotation from
the master process. That's where
toor comes in handy.
First of all, require
toor near the top of your file.
const toor =
From your master process, you can call
toor.pause(worker, cb) on a worker.
The callback is called when all connections are done and the worker is no longer
accepting new requests.
To have the worker start accepting requests again, call
toor.unpause(worker, cb) on it.
tooris invasive. It does a lot of shimming in the
clustermodules. If you're not comfortable with that, I'm sorrry!
Code licensed under MIT license. See LICENSE.txt