close chidl processes when parent exits

This commit is contained in:
Jan Prochazka
2020-05-01 09:35:57 +02:00
parent 17134552ce
commit 933f29afda
9 changed files with 39 additions and 4 deletions

View File

@@ -27,7 +27,12 @@ module.exports = {
},
test(req, res) {
const subprocess = fork(process.argv[1], ['connectProcess']);
subprocess.on('message', (resp) => res.json(resp));
subprocess.on('message', (resp) => {
const { msgtype } = res;
if (msgtype == 'connected' || msgtype == 'error') {
res.json(resp);
}
});
subprocess.send(req.body);
},

View File

@@ -24,6 +24,7 @@ module.exports = {
resolve(response);
delete this.requests[msgid];
},
handle_ping() {},
async ensureOpened(conid, database) {
const existing = this.opened.find((x) => x.conid == conid && x.database == database);

View File

@@ -14,6 +14,8 @@ module.exports = {
handle_error(conid, { error }) {
console.log(`Error in server connection ${conid}: ${error}`);
},
handle_ping() {
},
async ensureOpened(conid) {
const existing = this.opened.find(x => x.conid == conid);

View File

@@ -58,6 +58,8 @@ module.exports = {
jsldata.notifyChangedStats(stats);
},
handle_ping() {},
create_meta: 'post',
async create({ conid, database }) {
const sesid = uuidv1();