cache bug fix - don't put used stale cache entries back into the cache

This commit is contained in:
Jon Atkins 2013-06-16 20:09:30 +01:00
parent 0b75b49b98
commit 6f4c98aa7e

View File

@ -156,6 +156,7 @@ window.handleDataResponse = function(data, fromCache) {
var ppp = {}; var ppp = {};
var p2f = {}; var p2f = {};
$.each(m, function(qk, val) { $.each(m, function(qk, val) {
var thisFromCache = fromCache;
if('error' in val) { if('error' in val) {
console.log('map data tile '+qk+' response error: '+val.error); console.log('map data tile '+qk+' response error: '+val.error);
@ -167,10 +168,11 @@ window.handleDataResponse = function(data, fromCache) {
return true; // $.each 'continue' return true; // $.each 'continue'
} else { } else {
console.log('(using stale cache entry for map tile)'); 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) { $.each(val.deletedGameEntityGuids || [], function(ind, guid) {
if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) { if(getTypeByGuid(guid) === TYPE_FIELD && window.fields[guid] !== undefined) {