postlight / lux

Build scalable, Node.js-powered REST JSON APIs with almost no code.
https://lux.postlight.com
MIT License
570 stars 60 forks source link

Disconnect event not listened to on worker shutdown #702

Closed nickschot closed 7 years ago

nickschot commented 7 years ago

When a worker is disconnected (by calling worker.disconnect()) it will emit a 'disconnect' when it's disconnected. Right now lux doesn't listen to this event causing the full timeout to be waited every time resulting in a fixed 5 second delay for shutting down a worker.

Can be fixed by also listening to the disconnect event.

Code: https://github.com/postlight/lux/blob/master/src/packages/pm/cluster/index.js#L194 Relevant tracking issue: #701