increase refresh timeout considerably when zoomed out. this will reduce requests to the servers when lots of data is visible

also, with the new higher tile count when zoomed out (#491) it reduces the odds of a new refresh starting before the old ones have finished
This commit is contained in:
Jon Atkins 2013-08-16 17:41:25 +01:00
parent 92433c5d4b
commit 3f1b8ba47f

View File

@ -121,7 +121,14 @@ window.startRefreshTimeout = function(override) {
} else { } else {
window.requests._quickRefreshPending = false; window.requests._quickRefreshPending = false;
t = REFRESH*1000; t = REFRESH*1000;
var adj = ZOOM_LEVEL_ADJ * (18 - window.map.getZoom());
// new getThinnedEntitiesV4 involves a LOT more requests when zoomed out above a data level of 13
// so, to give the refresh a chance to complete (and also reduce load on niantic servers), boost the refresh interval
// in this case
// (TODO: complete rewrite of refresh+request handling. don't start timer until complete, and retry error=TIMEOUT requests)
if (getPortalDataZoom() <=12 ) t = t*4;
var adj = ZOOM_LEVEL_ADJ * (18 - getPortalDataZoom());
if(adj > 0) t += adj*1000; if(adj > 0) t += adj*1000;
} }
var next = new Date(new Date().getTime() + t).toLocaleTimeString(); var next = new Date(new Date().getTime() + t).toLocaleTimeString();