remove the delay before requeueing 'error==TIMEOUT' tiles. it's not needed (stock site has no delay), and the other delay (before processing the queue again) has more than enough effect to batch multiple retries together when it's useful
This commit is contained in:
parent
8270812406
commit
d268b0a79f
@ -42,8 +42,7 @@ window.MapDataRequest = function() {
|
|||||||
// this gives a chance of other requests finishing, allowing better grouping of retries in new requests
|
// this gives a chance of other requests finishing, allowing better grouping of retries in new requests
|
||||||
this.RUN_QUEUE_DELAY = 0.5;
|
this.RUN_QUEUE_DELAY = 0.5;
|
||||||
|
|
||||||
// delay before re-queueing tiles
|
// delay before re-queueing tiles in failed requests
|
||||||
this.TILE_TIMEOUT_REQUEUE_DELAY = 0.2; // short delay before retrying a 'error==TIMEOUT' tile. a common 'error', and the stock site has no delay in this case
|
|
||||||
this.BAD_REQUEST_REQUEUE_DELAY = 5; // longer delay before retrying a completely failed request - as in this case the servers are struggling
|
this.BAD_REQUEST_REQUEUE_DELAY = 5; // longer delay before retrying a completely failed request - as in this case the servers are struggling
|
||||||
|
|
||||||
// a delay before processing the queue after requeueing tiles. this gives a chance for other requests to finish
|
// a delay before processing the queue after requeueing tiles. this gives a chance for other requests to finish
|
||||||
@ -513,7 +512,6 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
|
|||||||
if (val.error == "TIMEOUT") {
|
if (val.error == "TIMEOUT") {
|
||||||
// TIMEOUT errors for individual tiles are 'expected'(!) - and result in a silent unlimited retries
|
// TIMEOUT errors for individual tiles are 'expected'(!) - and result in a silent unlimited retries
|
||||||
timeoutTiles.push (id);
|
timeoutTiles.push (id);
|
||||||
this.debugTiles.setState (id, 'tile-timeout');
|
|
||||||
} else {
|
} else {
|
||||||
console.warn('map data tile '+id+' failed: error=='+val.error);
|
console.warn('map data tile '+id+' failed: error=='+val.error);
|
||||||
errorTiles.push (id);
|
errorTiles.push (id);
|
||||||
@ -588,21 +586,20 @@ console.log('processed delta mapData request:'+id+': '+oldEntityCount+' original
|
|||||||
console.log ('getThinnedEntities status: '+tiles.length+' tiles: '+successTiles.length+' successful, '+timeoutTiles.length+' timed out, '+errorTiles.length+' failed');
|
console.log ('getThinnedEntities status: '+tiles.length+' tiles: '+successTiles.length+' successful, '+timeoutTiles.length+' timed out, '+errorTiles.length+' failed');
|
||||||
|
|
||||||
|
|
||||||
|
// requeue any 'timeout' tiles immediately
|
||||||
|
if (timeoutTiles.length > 0) {
|
||||||
|
for (var i in timeoutTiles) {
|
||||||
|
var id = timeoutTiles[i];
|
||||||
|
delete this.requestedTiles[id];
|
||||||
|
this.requeueTile(id, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// but for other errors, delay before retrying (as the server is having issues)
|
||||||
|
if (errorTiles.length > 0) {
|
||||||
//setTimeout has no way of passing the 'context' (aka 'this') to it's function
|
//setTimeout has no way of passing the 'context' (aka 'this') to it's function
|
||||||
var savedContext = this;
|
var savedContext = this;
|
||||||
|
|
||||||
if (timeoutTiles.length > 0) {
|
|
||||||
setTimeout (function() {
|
|
||||||
for (var i in timeoutTiles) {
|
|
||||||
var id = timeoutTiles[i];
|
|
||||||
delete savedContext.requestedTiles[id];
|
|
||||||
savedContext.requeueTile(id, false);
|
|
||||||
}
|
|
||||||
savedContext.delayProcessRequestQueue(this.REQUEUE_DELAY);
|
|
||||||
}, this.TILE_TIMEOUT_REQUEUE_DELAY*1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorTiles.length > 0) {
|
|
||||||
setTimeout (function() {
|
setTimeout (function() {
|
||||||
for (var i in errorTiles) {
|
for (var i in errorTiles) {
|
||||||
var id = errorTiles[i];
|
var id = errorTiles[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user