Verified Commit fded74cb authored by Camil Staps's avatar Camil Staps 🚀

Reconnect when the iTasks server does not start up quickly enough; do not kill...

Reconnect when the iTasks server does not start up quickly enough; do not kill the iTasks server when the node process exits (both needed when profiling is enabled)
parent 3bc6beec
......@@ -59,11 +59,12 @@ class Component {
this.socket.on ('data',this.onData.bind (this));
this.socket.on ('close',() => {
console.log ('server exited');
// TODO how to handle this?
});
this.socket.on ('error',err => {
console.log ('connection error:',err.message);
// TODO how to handle this?
if (err.errno=='ECONNREFUSED')
setTimeout (() => this.socket.connect (err.port,err.address), 100);
else
console.log ('connection error:',err.message);
});
}
......@@ -192,10 +193,7 @@ function run (_opts) {
console.log ('iTasks exited with exit code '+code);
app.quit(code);
});
process.on ('exit',() => server.kill (9));
// TODO: this assumes that the iTasks server has started up by the time we
// have initialized the ABC interpreter, which might not be the case
return Component.instantiate (opts);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment