Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

Commit 976355d

Browse files
committed
add suspect, faulty and tombstone period flags (#280)
add suspect, faulty and tombstone period flags
1 parent e33ee6d commit 976355d

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

main.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,27 @@ var TChannel = require('tchannel');
2626
function main(args) {
2727
program
2828
.version(require('./package.json').version)
29+
2930
.usage('[options]')
30-
.option('-l, --listen <listen>', 'Host and port on which server listens (also node\'s identity in cluster)')
31-
.option('-h, --hosts <hosts>', 'Seed file of list of hosts to join')
31+
32+
.option('-l, --listen <listen>',
33+
'Host and port on which server listens (also node\'s identity in cluster)')
34+
35+
.option('-h, --hosts <hosts>',
36+
'Seed file of list of hosts to join')
37+
38+
.option('--suspect-period <suspectPeriod>',
39+
'The lifetime of a suspect member in ms. After that the member becomes faulty.',
40+
parseInt10, 5000)
41+
42+
.option('--faulty-period <faultyPeriod>',
43+
'The lifetime of a faulty member in ms. After that the member becomes a tombstone.',
44+
parseInt10, 24*60*60*1000) // 24hours
45+
46+
.option('--tombstone-period <tombstonePeriod>',
47+
'The lifetime of a tombstone member in ms. After that the member is removed from the membership.',
48+
parseInt10, 5000)
49+
3250
.parse(args);
3351

3452
var listen = program.listen;
@@ -51,8 +69,9 @@ function main(args) {
5169
}),
5270
isCrossPlatform: true,
5371
stateTimeouts: {
54-
faulty: 5 * 1000, // 5s
55-
tombstone: 5 * 1000 // 5s
72+
suspect: program.suspectPeriod,
73+
faulty: program.faultyPeriod,
74+
tombstone: program.tombstonePeriod,
5675
}
5776
});
5877

@@ -68,6 +87,10 @@ function main(args) {
6887
}
6988
}
7089

90+
function parseInt10(str) {
91+
return parseInt(str, 10);
92+
}
93+
7194
function createLogger(name) {
7295
return {
7396
trace: function noop() {},

0 commit comments

Comments
 (0)