Fix horribly broken code
This commit is contained in:
parent
7ac62da3c9
commit
5012cd7771
16
app.js
16
app.js
@ -33,10 +33,10 @@ function pingAll() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (networkSnapshot) {
|
if (res) {
|
||||||
object.result = res;
|
networkSnapshot.result = res;
|
||||||
} else if (err) {
|
} else if (err) {
|
||||||
networkSnapshot.err = error;
|
networkSnapshot.error = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
server.io.sockets.emit('update', networkSnapshot);
|
server.io.sockets.emit('update', networkSnapshot);
|
||||||
@ -80,19 +80,13 @@ function pingAll() {
|
|||||||
|
|
||||||
// Start our main loop that does everything.
|
// Start our main loop that does everything.
|
||||||
function startMainLoop() {
|
function startMainLoop() {
|
||||||
setInterval(pingAll, config.rates.pingAll);
|
util.setIntervalNoDelay(pingAll, config.rates.pingAll);
|
||||||
|
|
||||||
setInterval(function() {
|
util.setIntervalNoDelay(function() {
|
||||||
mojang.update(config.rates.mojangStatusTimeout);
|
mojang.update(config.rates.mojangStatusTimeout);
|
||||||
|
|
||||||
server.io.sockets.emit('updateMojangServices', mojang.toMessage());
|
server.io.sockets.emit('updateMojangServices', mojang.toMessage());
|
||||||
}, config.rates.upateMojangStatus);
|
}, config.rates.upateMojangStatus);
|
||||||
|
|
||||||
// Manually fire the first round of our tasks.
|
|
||||||
mojang.update(config.rates.mojangStatusTimeout);
|
|
||||||
server.io.sockets.emit('updateMojangServices', mojang.toMessage());
|
|
||||||
|
|
||||||
pingAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server.start(function() {
|
server.start(function() {
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
exports.getCurrentTimeMs = function() {
|
exports.getCurrentTimeMs = function() {
|
||||||
return new Date().getTime();
|
return new Date().getTime();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.setIntervalNoDelay = function(func, delay) {
|
||||||
|
var task = setInterval(func, delay);
|
||||||
|
|
||||||
|
func();
|
||||||
|
|
||||||
|
return task;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user