Skip to content

Commit ffc7813

Browse files
committed
Found bug causing newFile to be called without info
1 parent ae5eff9 commit ffc7813

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class RotatingFileStream {
4949
this._rotatingLock = true;
5050
await this._queue.pause();
5151
const nextFileHandle = await this._rotator.rotate();
52-
this._triggers.forEach(trigger => trigger.newFile());
5352
this._queue.setFileHandle(nextFileHandle);
5453
this._rotatingLock = false;
5554
}

test/filerotate.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,22 @@ describe('RotatingFileStream', function () {
7777
});
7878
await stream.end();
7979
});
80+
81+
it('Goes fast with short periods', async function () {
82+
const stream = new RotatingFileStream({
83+
period: '50ms',
84+
...testConfig
85+
});
86+
const logger = bunyan.createLogger({
87+
name: 'foo',
88+
streams: [{
89+
stream
90+
}]
91+
});
92+
for (let i = 0; i < 10; i++) {
93+
logger.info(`Testing ${i}!`);
94+
await delay(50);
95+
}
96+
await stream.end();
97+
});
8098
});

0 commit comments

Comments
 (0)