From 6f4c98aa7e8bb5ff7aec2ff2bde0f422a453a901 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 16 Jun 2013 20:09:30 +0100 Subject: [PATCH] cache bug fix - don't put used stale cache entries back into the cache --- code/map_data.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/map_data.js b/code/map_data.js index 18d59d85..c7446b6b 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -156,6 +156,7 @@ window.handleDataResponse = function(data, fromCache) { var ppp = {}; var p2f = {}; $.each(m, function(qk, val) { + var thisFromCache = fromCache; if('error' in val) { console.log('map data tile '+qk+' response error: '+val.error); @@ -167,10 +168,11 @@ window.handleDataResponse = function(data, fromCache) { return true; // $.each 'continue' } else { console.log('(using stale cache entry for map tile)'); + thisFromCache = true; } } - if (!fromCache) storeDataCache(qk,val); + if (!thisFromCache) storeDataCache(qk,val); $.each(val.deletedGameEntityGuids || [], function(ind, guid) { if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {