Skip to content

Commit

Permalink
Spread requests over all available buckets
Browse files Browse the repository at this point in the history
Smaller requests are quicker and allows requesting timed-out cells more quickly. by @ah42
iitc-project/ingress-intel-total-conversion#1131
#2
  • Loading branch information
modos189 committed Nov 28, 2018
1 parent 0eb97bb commit 7fa37b0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/map_data_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,12 @@ window.MapDataRequest.prototype.processRequestQueue = function(isFirstPass) {
var requestBuckets = this.MAX_REQUESTS - this.activeRequestCount;
if (pendingTiles.length > 0 && requestBuckets > 0) {

var requestBucketSize = Math.min(this.NUM_TILES_PER_REQUEST, Math.max(5, Math.ceil(pendingTiles.length / requestBuckets)));
for (var bucket=0; bucket < requestBuckets; bucket++) {

// if the tiles for this request have had several retries, use smaller requests
// maybe some of the tiles caused all the others to error? no harm anyway, and it may help...
var numTilesThisRequest = Math.min(this.NUM_TILES_PER_REQUEST,pendingTiles.length);
var numTilesThisRequest = Math.min(requestBucketSize, pendingTiles.length);

var id = pendingTiles[0];
var retryTotal = (this.tileErrorCount[id]||0);
Expand Down

0 comments on commit 7fa37b0

Please sign in to comment.