Closed joshuarubin closed 5 months ago
what's the use-case for deferring the connection?
I have some workers that need to fetch data from remote sites and/or do some disk loads before they will return acceptable results. I am using cluster for a very high volume web api and I am primarily concerned that the requests that come in from the time the worker is added, until initialized, will fail.
I think I'd rather tackle this from a more abstract point of view, so that plugins could defer listening as well, then the logic you want to defer could just be a plugin, which happens to be specific to your app, but still just a plugin
That would work well for me too. I am happy to help.
actually never mind that, the api for exposing a plugin to the workers is pretty lame right now so that's not a great solution
Some workers may require an initialization sequence before they should connect to the socket.
In order to utilize this, simply add: .set('worker init', 'method name') to your cluster instance.
'method name' must be a method of the server that takes one callback argument as follows:
function server.worker_init(callback) {