Fix: Delete old favicons, save us tons of bandwidth

This commit is contained in:
Cryptkeeper 2015-11-24 00:34:00 -06:00
parent 4c3535a9d0
commit 7ac62da3c9

26
app.js
View File

@ -26,14 +26,20 @@ function pingAll() {
res.favicon = config.faviconOverride[network.name];
}
server.io.sockets.emit('update', {
result: res,
error: err,
info: {
name: network.name,
timestamp: util.getCurrentTimeMs()
}
});
var networkSnapshot = {
info: {
name: network.name,
timestamp: util.getCurrentTimeMs()
}
};
if (networkSnapshot) {
object.result = res;
} else if (err) {
networkSnapshot.err = error;
}
server.io.sockets.emit('update', networkSnapshot);
// Log our response.
if (!networkHistory[network.ip]) {
@ -45,6 +51,10 @@ function pingAll() {
// Remove our previous data that we don't need anymore.
for (var i = 0; i < _networkHistory.length; i++) {
delete _networkHistory[i].info;
if (_networkHistory[i].result) {
delete _networkHistory[i].result.favicon;
}
}
_networkHistory.push({