Open ikonst opened 3 months ago
This approach doesn't quite work since not all workers may be dead when the primary process disconnects. You actually need to effectively wait for workers to exit before exiting the primary process. I spawned a library based on throng that I was using for my own application development for a while that handles this case -- https://www.npmjs.com/package/thart?activeTab=readme
Specifically, see here https://github.com/ramipellumbi/thart/blob/f5ce0b17df80dbae8054e28efa3782bdb5063b8c/src/primary.ts#L62
... when the primary process disconnects.
You mean, when the worker disconnects from the master process?
Currently we're waiting for the grace timeout regardless of the workers terminating.
Something like this: