From 3f1b8ba47f1a138b514c36202eed26d424019e96 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 16 Aug 2013 17:41:25 +0100 Subject: [PATCH] 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 --- code/request_handling.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/request_handling.js b/code/request_handling.js index 90368909..722333b2 100644 --- a/code/request_handling.js +++ b/code/request_handling.js @@ -121,7 +121,14 @@ window.startRefreshTimeout = function(override) { } else { window.requests._quickRefreshPending = false; 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; } var next = new Date(new Date().getTime() + t).toLocaleTimeString();