#185 add some comments, const, Daniel to authors, and changelog

This commit is contained in:
Trent Mick 2014-11-17 21:45:41 -08:00
parent a280863be6
commit 980e281096
3 changed files with 13 additions and 5 deletions

View file

@ -16,3 +16,4 @@ Ryan Graham (https://github.com/rmg)
Alex Kocharin (https://github.com/rlidwka)
Andrei Neculau (https://github.com/andreineculau)
Mihai Tomescu (https://github.com/matomesc)
Daniel Juhl (https://github.com/danieljuhl)

View file

@ -8,7 +8,9 @@ Known issues:
## bunyan 1.2.3 (not yet released)
(nothing yet)
- [issue #184] Fix log rotation for rotation periods > ~25 days. Before this
change, a rotation period longer than this could hit [the maximum setTimeout
delay in node.js](https://github.com/joyent/node/issues/8656). By Daniel Juhl.
## bunyan 1.2.2

View file

@ -1083,8 +1083,11 @@ RotatingFileStream.prototype._setupNextRot = function () {
var self = this;
this.rotAt = this._nextRotTime();
var delay = this.rotAt - Date.now();
if (delay > 2147483647) {
delay = 2147483647;
// Cap timeout to Node's max setTimeout, see
// <https://github.com/joyent/node/issues/8656>.
var TIMEOUT_MAX = 2147483647; // 2^31-1
if (delay > TIMEOUT_MAX) {
delay = TIMEOUT_MAX;
}
this.timeout = setTimeout(
function () { self.rotate(); },
@ -1179,6 +1182,8 @@ RotatingFileStream.prototype.rotate = function rotate() {
var self = this;
var _DEBUG = false;
// If rotation period is > ~25 days, we have to break into multiple
// setTimeout's. See <https://github.com/joyent/node/issues/8656>.
if (self.rotAt && self.rotAt > Date.now()) {
return self._setupNextRot();
}