don't attempt to update graphs if we're not connected

v1.18.x
psychobunny 11 years ago
parent 6a6f0a3b78
commit 806b115782

@ -17,7 +17,7 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
clearInterval(updateIntervalId); clearInterval(updateIntervalId);
} }
updateIntervalId = setInterval(function() { updateIntervalId = setInterval(function() {
if (app.isFocused) { if (app.isFocused && app.isConnected) {
socket.emit('meta.rooms.getAll', Admin.updateRoomUsage); socket.emit('meta.rooms.getAll', Admin.updateRoomUsage);
} }
}, 5000); }, 5000);
@ -305,10 +305,10 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
} }
function updateTrafficGraph() { function updateTrafficGraph() {
if (!app.isFocused) { if (!app.isFocused || !app.isConnected) {
return; return;
} }
socket.emit('admin.analytics.get', {graph: "traffic"}, function (err, data) { socket.emit('admin.analytics.get', {graph: "traffic"}, function (err, data) {
for (var i = 0, ii = data.pageviews.length; i < ii; i++) { for (var i = 0, ii = data.pageviews.length; i < ii; i++) {
graphs.traffic.datasets[0].points[i].value = data.pageviews[i]; graphs.traffic.datasets[0].points[i].value = data.pageviews[i];

Loading…
Cancel
Save