From 0494e6c988ff9faa63c011ff4219a47daf3b74ea Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Wed, 26 Jun 2013 22:04:39 +0100 Subject: [PATCH] simplify logic for grouping map data requests into buckets - zero advantages seen with various different grouping methods tried reduce the bucket size limit - same number of requests at normal resolutions, and less timeouts (but more requests) at higher resolutions --- code/map_data.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index f8f46473..46201e29 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -115,7 +115,9 @@ window.requestData = function() { expireDataCache(); //a limit on the number of map tiles to be pulled in a single request - var MAX_TILES_PER_BUCKET = 20; + var MAX_TILES_PER_BUCKET = 11; + // the number of separate buckets. more can be created if the size exceeds MAX_TILES_PER_BUCKET + var BUCKET_COUNT = 4; var bounds = clampLatLngBounds(map.getBounds()); @@ -156,12 +158,7 @@ window.requestData = function() { window.statusCachedMapTiles++; } else { // group requests into buckets based on the tile coordinate. - - var bucket = (Math.floor(x/2)%2)+":"+(Math.floor(y/2)%2); -//some alternative/experimental bucket groupings, to see what can be done to reduce/eliminate the 'TIMEOUT' errors returned in some requests -// var bucket = Math.floor((x-x1)/8)+":"+Math.floor((y-y1)/8)+"/"+(Math.floor(x/2)%2)+":"+(Math.floor(y/2)%2); -// var bucket = Math.floor(x/4)+":"+Math.floor(y/4); -// var bucket = Math.floor(x/3)+":"+Math.floor(y/3); + var bucket = Math.floor(x+y*(BUCKET_COUNT/2))%BUCKET_COUNT; if (!tiles[bucket]) { //create empty bucket