Fix missing servers when refreshing too early
This commit is contained in:
parent
798dda8f12
commit
584d7374df
23
app.js
23
app.js
@ -170,8 +170,27 @@ function startServices() {
|
|||||||
networkHistoryKeys.sort();
|
networkHistoryKeys.sort();
|
||||||
|
|
||||||
// Send each individually, this should look cleaner than waiting for one big array to transfer.
|
// Send each individually, this should look cleaner than waiting for one big array to transfer.
|
||||||
for (var i = 0; i < networkHistoryKeys.length; i++) {
|
for (var i = 0; i < servers.length; i++) {
|
||||||
client.emit('add', [networkHistory[networkHistoryKeys[i]]]);
|
var server = servers[i];
|
||||||
|
|
||||||
|
if (!(server.name in networkHistory) || networkHistory[server.name].length < 1) {
|
||||||
|
// This server hasn't been ping'd yet. Send a hacky placeholder.
|
||||||
|
client.emit('add', [[{
|
||||||
|
error: {
|
||||||
|
description: 'Waiting'
|
||||||
|
},
|
||||||
|
result: null,
|
||||||
|
timestamp: util.getCurrentTimeMs(),
|
||||||
|
info: {
|
||||||
|
ip: server.ip,
|
||||||
|
port: server.port,
|
||||||
|
type: server.type,
|
||||||
|
name: server.name
|
||||||
|
}
|
||||||
|
}]]);
|
||||||
|
} else {
|
||||||
|
client.emit('add', [networkHistory[networkHistoryKeys[i]]]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user