Skip to content

Commit 985f028

Browse files
committed
Use long-timeout to enable timeouts longer than 28 days
fixes: #9
1 parent e065a75 commit 985f028

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

lib/periodTrigger.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const {EventEmitter} = require('events');
22
const {Rotate} = require('./customEvents');
33
const {processPeriod} = require('../util/configProcessors');
4+
const {setTimeout, clearTimeout} = require('long-timeout');
45

56
const getNextRotation = (period, lastRotation) => {
67
var date = new Date();

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
"should": "13.2.3",
2323
"sinon": "9.2.4"
2424
},
25-
"dependencies": {}
25+
"dependencies": {
26+
"long-timeout": "^0.1.1"
27+
}
2628
}

test/filerotate.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,18 @@ describe('RotatingFileStream', function () {
5858
});
5959
await stream.end();
6060
});
61+
62+
it('Sets up long periods correctly', async function () {
63+
const stream = new RotatingFileStream({
64+
period: '1y',
65+
...testConfig
66+
});
67+
bunyan.createLogger({
68+
name: 'foo',
69+
streams: [{
70+
stream
71+
}]
72+
});
73+
await stream.end();
74+
});
6175
});

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,11 @@ [email protected]:
10091009
dependencies:
10101010
chalk "^4.0.0"
10111011

1012+
long-timeout@^0.1.1:
1013+
version "0.1.1"
1014+
resolved "https://registry.yarnpkg.com/long-timeout/-/long-timeout-0.1.1.tgz#9721d788b47e0bcb5a24c2e2bee1a0da55dab514"
1015+
integrity sha1-lyHXiLR+C8taJMLivuGg2lXatRQ=
1016+
10121017
lower-case@^2.0.2:
10131018
version "2.0.2"
10141019
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28"

0 commit comments

Comments
 (0)