afd

Accrual Failure Detector

npm install afd
1 downloads in the last day
19 downloads in the last week
31 downloads in the last month

Accrual Failure Detector

NPM version Build Status Dependency Status Coverage Status

install

$ npm install afd
$ component install kordon/afd

example

var afd = require('afd')
var peers = {}

server.on('message', function(msg) {
  if(msg.type !== 'ping') return
  if(!peers[server.id]) peers[server.id] = afd()
  peers[server.id].report()
})

setInterval(function() {
  Object.keys(peers).forEach(function (id) {
    if(peers[id].phi() > 8) console.error('Node %s has probably failed!', id)
    else console.log('Node %s is alive!', id)
  })
}, 1000)

documentation

license

npm loves you