From 51b24386e6296f04994a32b0f344173007619165 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Mon, 14 Oct 2013 17:59:53 +0100 Subject: [PATCH] disable 'timestampMs' map data requests. either i've misunderstood what their code is doing, or it's an incomplete feature in the stock site. extensive testing has never found an instance where it reduced response size from the server --- code/map_data_cache.js | 4 +++- code/map_data_request.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/code/map_data_cache.js b/code/map_data_cache.js index 6dcda1a8..d6868557 100644 --- a/code/map_data_cache.js +++ b/code/map_data_cache.js @@ -9,7 +9,9 @@ window.DataCache = function() { // for, retrieving deltas) so use a long max age to take advantage of this // however, ther must be an overall limit on the maximum age of data from the servers, otherwise the deletedEntity // entries would grow indefinitely. an hour seems reasonable from experience with the data, so 55 mins max cache time - this.REQUEST_CACHE_MAX_AGE = 55*60; // maximum cache age. entries are deleted from the cache after this time +// this.REQUEST_CACHE_MAX_AGE = 55*60; // maximum cache age. entries are deleted from the cache after this time +//UPDATE: this timestampMs parameter doesn't work, so reduced max age to limit RAM usage + this.REQUEST_CACHE_MAX_AGE = 5*60; // maximum cache age. entries are deleted from the cache after this time if (L.Browser.mobile) { // on mobile devices, smaller cache size diff --git a/code/map_data_request.js b/code/map_data_request.js index ff839663..79ce5599 100644 --- a/code/map_data_request.js +++ b/code/map_data_request.js @@ -252,6 +252,9 @@ window.MapDataRequest.prototype.refresh = function() { lngEast ); +/* After some testing, this doesn't seem to actually work. The server returns the same data with and without the parameter + * Also, closer study of the stock site code shows the parameter isn't actually set anywhere. + * so, disabling for now... // however, the server does support delta requests - only returning the entities changed since a particular timestamp // retrieve the stale cache entry and use it, if possible var stale = (this.cache && this.cache.get(tile_id)); @@ -275,6 +278,7 @@ console.log('stale tile '+tile_id+': newest mtime '+lastTimestamp+(lastTimestamp boundsParams.timestampMs = lastTimestamp; } } +*/ this.tileBounds[tile_id] = boundsParams; this.requestedTileCount += 1; @@ -504,6 +508,7 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success) var stale = this.requestedTiles[id].staleData; if (stale) { +//NOTE: currently this code path won't be used, as we never set the staleData to anything other than 'undefined' // we have stale data. therefore, a delta request was made for this tile. we need to merge the results with // the existing stale data before proceeding