diff --git a/lib/engine.js b/lib/engine.js index 691e97bfbf..a1221a8b8f 100644 --- a/lib/engine.js +++ b/lib/engine.js @@ -758,7 +758,14 @@ module.exports = function (s, conf) { } function withOnPeriod (trade, period_id, cb) { - if (!clock && so.mode !== 'live' && so.mode !== 'paper') clock = lolex.install({ shouldAdvanceTime: false, now: trade.time }) + if (!clock && so.mode !== 'live' && so.mode !== 'paper') clock = lolex.install( + { + shouldAdvanceTime: false, + now: trade.time, + toFake: [ + 'setTimeout' + ] + }) updatePeriod(trade) if (!s.in_preroll) { @@ -776,7 +783,7 @@ module.exports = function (s, conf) { clock.tick(5000) diff -= 5000 } - clock.tick(diff) + clock.tick(diff < 0 ? 1 : diff) } if (s.signal) {