Skip to content

Commit

Permalink
bugfix askmike#2457
Browse files Browse the repository at this point in the history
Sometimes child.kill() failes. Better disconnect the parent and let the
child exit itself.
  • Loading branch information
eusorov committed Aug 21, 2018
1 parent 172caf8 commit d601fb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/workers/loadCandles/child.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ process.send('ready');
process.on('message', (m) => {
if(m.what === 'start')
start(m.config, m.candleSize, m.daterange);
});
});

process.on('disconnect', function() {
process.exit(0);
})
2 changes: 1 addition & 1 deletion core/workers/loadCandles/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = (config, callback) => {

// else we are done and have candles!
done(null, m);
child.kill('SIGINT');
this.disconnect();
});

child.on('exit', code => {
Expand Down

0 comments on commit d601fb2

Please sign in to comment.