Don't advance to next rotation time when timeout fires early
Fixes #344
This commit is contained in:
parent
97a678d8d1
commit
d9c5970be2
3 changed files with 12 additions and 2 deletions
1
AUTHORS
1
AUTHORS
|
@ -34,3 +34,4 @@ Mark Stosberg (https://github.com/markstos)
|
|||
Alexander Ray (https://github.com/aray12)
|
||||
Adam Lynch (https://github.com/adam-lynch)
|
||||
Michael Nisi (https://github.com/michaelnisi)
|
||||
Martijn Schrage (https://github.com/Oblosys)
|
||||
|
|
|
@ -8,6 +8,11 @@ Known issues:
|
|||
|
||||
## 1.7.1 (not yet released)
|
||||
|
||||
- [issue #344] Fix "rotating-file" Bunyan streams to not miss rotations when configured
|
||||
for a period greater than approximately 25 days. Before this there was an issue
|
||||
where periods greater than node.js's maximum `setTimeout` length would fail to rotate.
|
||||
(By Martijn Schrage.)
|
||||
|
||||
- [issue #234, pull #345] Improve `bunyan` CLI rendering of "res" field
|
||||
HTTP responses to not show two blank lines for an empty body.
|
||||
(By Michael Nisi.)
|
||||
|
|
|
@ -1219,8 +1219,12 @@ RotatingFileStream = function RotatingFileStream(options) {
|
|||
util.inherits(RotatingFileStream, EventEmitter);
|
||||
|
||||
RotatingFileStream.prototype._setupNextRot = function () {
|
||||
var self = this;
|
||||
this.rotAt = this._nextRotTime();
|
||||
this._setRotationTimer();
|
||||
}
|
||||
|
||||
RotatingFileStream.prototype._setRotationTimer = function () {
|
||||
var self = this;
|
||||
var delay = this.rotAt - Date.now();
|
||||
// Cap timeout to Node's max setTimeout, see
|
||||
// <https://github.com/joyent/node/issues/8656>.
|
||||
|
@ -1324,7 +1328,7 @@ RotatingFileStream.prototype.rotate = function rotate() {
|
|||
// 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();
|
||||
return self._setRotationTimer();
|
||||
}
|
||||
|
||||
if (_DEBUG) {
|
||||
|
|
Loading…
Reference in a new issue