Open Julusian opened 3 years ago
Hey @Julusian!
On what platform are you: Browser, node.js, electron? It is almost impossible to have a solution for this issue that reliably works across all of these platforms, but maybe it's good enough for now if we can fix it for your specific use case.
This is nodejs 14
Let's check if subscribing to workers' exit
event does the job…
I have a simple case where if a child terminates, that is never reported back to the application in a way that can be handled.
test-child.ts
run.ts
Note: the code is written in typescript, but it is being compiled to js before executing, so this shouldnt be something ts-node specific.
The output of this ends up being:
If I remove the setInterval, then it instead immediately terminates, so the worker_thread is definitely terminating.
I would expect a line
master: it errored
to be logged as the call failed, and probably aThread event:
too so that the dead worker can be restarted