diff --git a/plugins/sqlite/writer.js b/plugins/sqlite/writer.js index e6155fc58..1a6515895 100644 --- a/plugins/sqlite/writer.js +++ b/plugins/sqlite/writer.js @@ -49,10 +49,11 @@ Store.prototype.upsertTables = function() { } Store.prototype.writeCandles = function() { + console.log(this.cache); if(_.isEmpty(this.cache)) return; - var transaction = function() { + const transaction = () => { this.db.run("BEGIN TRANSACTION"); var stmt = this.db.prepare(` @@ -81,11 +82,13 @@ Store.prototype.writeCandles = function() { stmt.finalize(); this.db.run("COMMIT"); + // TEMP: should fix https://forum.gekko.wizb.it/thread-57279-post-59194.html#pid59194 + this.db.run("pragma wal_checkpoint;"); this.cache = []; } - this.db.serialize(_.bind(transaction, this)); + this.db.serialize(transaction); } var processCandle = function(candle, done) {