Skip to content

Commit

Permalink
Clear interval rather than relying on unref()
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy committed Mar 8, 2017
1 parent 619112e commit c4424a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ Runner.prototype.run = function run() {
});

// TODO: Use nanotimer
setInterval(
this._statsInterval = setInterval(
this._sendStats.bind(this),
this._script.config.statsInterval * 1000).unref();
this._script.config.statsInterval * 1000);
return this;
};

Expand Down Expand Up @@ -197,6 +197,7 @@ Runner.prototype._onWorkerMessage = function _onWorkerMessage(message) {
}

if (message.event === 'done') {
clearInterval(this._statsInterval);
let worker = this._workers[message.pid];
worker.isDone = true;
worker.proc.send({command: 'stop'});
Expand Down

0 comments on commit c4424a4

Please sign in to comment.