Skip to content

Commit

Permalink
Fix #97 unref() the rotation timeout in RotatingFileStream.
Browse files Browse the repository at this point in the history
The rotation `setTimeout` from `RotatingFileStream` will prevent the process from exiting.
This fix simply `unref()` the timeout immediately after it is set.
  • Loading branch information
Chakrit Wichian committed Aug 21, 2013
1 parent 27b679f commit 9036035
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,9 @@ RotatingFileStream.prototype._setupNextRot = function () {
this.timeout = setTimeout(
function () { self.rotate(); },
this.rotAt - Date.now());
if (typeof this.timeout.unref === 'function') {
this.timeout.unref();
}
}

RotatingFileStream.prototype._nextRotTime = function _nextRotTime(first) {
Expand Down

0 comments on commit 9036035

Please sign in to comment.