diff --git a/main.js b/main.js index dc8fd2c8..b66126d4 100755 --- a/main.js +++ b/main.js @@ -26,9 +26,27 @@ var TChannel = require('tchannel'); function main(args) { program .version(require('./package.json').version) + .usage('[options]') - .option('-l, --listen ', 'Host and port on which server listens (also node\'s identity in cluster)') - .option('-h, --hosts ', 'Seed file of list of hosts to join') + + .option('-l, --listen ', + 'Host and port on which server listens (also node\'s identity in cluster)') + + .option('-h, --hosts ', + 'Seed file of list of hosts to join') + + .option('--suspect-period ', + 'The lifetime of a suspect member in ms. After that the member becomes faulty.', + parseInt10, 5000) + + .option('--faulty-period ', + 'The lifetime of a faulty member in ms. After that the member becomes a tombstone.', + parseInt10, 24*60*60*1000) // 24hours + + .option('--tombstone-period ', + 'The lifetime of a tombstone member in ms. After that the member is removed from the membership.', + parseInt10, 5000) + .parse(args); var listen = program.listen; @@ -51,8 +69,9 @@ function main(args) { }), isCrossPlatform: true, stateTimeouts: { - faulty: 5 * 1000, // 5s - tombstone: 5 * 1000 // 5s + suspect: program.suspectPeriod, + faulty: program.faultyPeriod, + tombstone: program.tombstonePeriod, } }); @@ -68,6 +87,10 @@ function main(args) { } } +function parseInt10(str) { + return parseInt(str, 10); +} + function createLogger(name) { return { trace: function noop() {},