Correctly ignore old servers in the db
This commit is contained in:
parent
1483a62711
commit
3dc10f571f
15
lib/util.js
15
lib/util.js
@ -36,6 +36,16 @@ function getServerNameByIp(ip) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getServerIps() {
|
||||||
|
var ips = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < servers.length; i++) {
|
||||||
|
ips.push(servers[i].ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ips;
|
||||||
|
}
|
||||||
|
|
||||||
// This method is a monstrosity.
|
// This method is a monstrosity.
|
||||||
// Since we loaded ALL pings from the database, we need to filter out the pings so each entry is a minute apart.
|
// Since we loaded ALL pings from the database, we need to filter out the pings so each entry is a minute apart.
|
||||||
// This is done by iterating over the list, since the time between each ping can be completely arbitrary.
|
// This is done by iterating over the list, since the time between each ping can be completely arbitrary.
|
||||||
@ -120,11 +130,16 @@ exports.setIntervalNoDelay = function(func, delay) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.convertPingsToGraph = function(sqlData) {
|
exports.convertPingsToGraph = function(sqlData) {
|
||||||
|
var serverIps = getServerIps();
|
||||||
var graphData = {};
|
var graphData = {};
|
||||||
|
|
||||||
for (var i = 0; i < sqlData.length; i++) {
|
for (var i = 0; i < sqlData.length; i++) {
|
||||||
var entry = sqlData[i];
|
var entry = sqlData[i];
|
||||||
|
|
||||||
|
if (serverIps.indexOf(entry.ip) === -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var name = getServerNameByIp(entry.ip);
|
var name = getServerNameByIp(entry.ip);
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user