map data now handles refreshes itself. this is so it can ensure that it doesn't start the refresh timer until all requests are complete

this avoids the situation where map data requests are slow enough that requests get aborted before a complete refresh has been done
This commit is contained in:
Jon Atkins
2013-08-27 05:42:59 +01:00
parent 0302d76a67
commit dc41671279
5 changed files with 107 additions and 77 deletions

View File

@ -129,23 +129,23 @@ window.startRefreshTimeout = function(override) {
if(adj > 0) t += adj*1000;
}
var next = new Date(new Date().getTime() + t).toLocaleTimeString();
console.log('planned refresh in ' + (t/1000) + ' seconds, at ' + next);
// console.log('planned refresh in ' + (t/1000) + ' seconds, at ' + next);
refreshTimeout = setTimeout(window.requests._callOnRefreshFunctions, t);
renderUpdateStatus();
}
window.requests._onRefreshFunctions = [];
window.requests._callOnRefreshFunctions = function() {
console.log('running refresh at ' + new Date().toLocaleTimeString());
// console.log('running refresh at ' + new Date().toLocaleTimeString());
startRefreshTimeout();
if(isIdle()) {
console.log('user has been idle for ' + idleTime + ' seconds, or window hidden. Skipping refresh.');
// console.log('user has been idle for ' + idleTime + ' seconds, or window hidden. Skipping refresh.');
renderUpdateStatus();
return;
}
console.log('refreshing');
// console.log('refreshing');
//store the timestamp of this refresh
window.requests._lastRefreshTime = new Date().getTime();