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.
|
||||
// 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.
|
||||
@ -120,11 +130,16 @@ exports.setIntervalNoDelay = function(func, delay) {
|
||||
};
|
||||
|
||||
exports.convertPingsToGraph = function(sqlData) {
|
||||
var serverIps = getServerIps();
|
||||
var graphData = {};
|
||||
|
||||
for (var i = 0; i < sqlData.length; i++) {
|
||||
var entry = sqlData[i];
|
||||
|
||||
if (serverIps.indexOf(entry.ip) === -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var name = getServerNameByIp(entry.ip);
|
||||
|
||||
if (!name) {
|
||||
|
Loading…
Reference in New Issue
Block a user