So I've created a service file that fires off a message listener. This service file has some logic in it to make sure that a worker process is fired...
Basically:
_parentProcess = function() { // logic to determine if process is parent) }
if (!_parentProcess()) {
_createParent();
} else {
_executeWorker();
}
_createParent will fork off the service.js file with a flag so that the next time the process runs, we are in a child/worker process.
The Worker process is what fires off my listener, now the problem I'm trying to wrap my head around is whether or not this is enough resource management? The listener gets a message that tells it to fire off some app. This app may take anywhere between 10 seconds to complete and 120 seconds to complete.
If it crashes, obviously, the service.js file handles that and just spins up another one but I'm more worried about blocking and using the most of my machine. Should I fork again in the listener the actual applications that I'm going to fire off or is this enough?