1
0
Fork 0

Heartbeats are now interpreted the new way

This commit is contained in:
Michael Hackstein 2014-03-01 14:07:58 +01:00
parent 59c597061c
commit 799f443b2f
2 changed files with 8 additions and 4 deletions

View File

@ -237,13 +237,13 @@
var resList = [],
list = servers.getList(),
diffList = diff.DBServers(),
noBeat = beats.noBeat(),
didBeat = beats.didBeat(),
serving = beats.getServing();
_.each(list, function(v, k) {
v.name = k;
resList.push(v);
if (_.contains(noBeat, k)) {
if (!_.contains(didBeat, k)) {
v.status = "critical";
return;
}
@ -264,12 +264,12 @@
var resList = [],
list = coords.getList(),
diffList = diff.Coordinators(),
noBeat = beats.noBeat();
didBeat = beats.didBeat();
_.each(list, function(v, k) {
v.name = k;
resList.push(v);
if (_.contains(noBeat, k)) {
if (!_.contains(didBeat, k)) {
v.status = "critical";
return;
}

View File

@ -701,6 +701,7 @@ exports.Communication = function() {
return res.sort();
};
this.noBeat = function() {
// Do not use, will only work in highly synced clocks
var lastAccepted = new Date((new Date()).getTime() - (2 * interval));
var res = [];
var list = this.list();
@ -711,6 +712,9 @@ exports.Communication = function() {
});
return res.sort();
};
this.didBeat = function() {
return _.keys(this.list());
};
};