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

18
app.js

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