Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Finish candleloader on empty data, fix #2457 #2475

Merged
merged 2 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/tools/candleLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const handleCandles = (err, data) => {
util.die('Encountered an error..')
}

if(_.size(data) && _.last(data).start >= toUnix)
if(_.size(data) && _.last(data).start >= toUnix || iterator.from.unix() >= toUnix)
DONE = true;

batcher.write(data);
Expand All @@ -97,4 +97,4 @@ const handleCandles = (err, data) => {

const handleBatchedCandles = candle => {
result.push(candle);
}
}
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