mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Re-request errored tiles with exponential back off

Open andrewharvey opened this issue 7 years ago • 5 comments

mapbox-gl-js version: master

Almost opposite to #1551, if a tile request returns a 5xx status code, should there be an exponential backoff to re-requesting it?

Related to the work you've been doing with respect to tile expiry @lbud?

andrewharvey avatar Mar 02 '17 12:03 andrewharvey

This would be extremely helpful. For example, right now mapbox will cache an error response until the tile comes into view again, even if the error response includes explicit caching headers or even a status code of 503 with a Retry-After header.

tgecho avatar Sep 15 '17 18:09 tgecho

Another scenario where this would be useful: we catch 401 status codes on the "error" event handler and reauthenticate silently. The requested tiles, however, are not retried and the map will just not show a layer the user has access to for no apparent reason. After some interaction with the map the tiles will be retried and everything would work as expected.

I would add that in my case just a method to retry failed tiles (instead of a back off) would fit quite well.

fergonco avatar Sep 22 '20 07:09 fergonco

+1 for re-request, with "Retry-After"

usecase: I'm hosting a TileServer where vector tiles are calculated on the fly... sometimes (cold-cache) it takes longer then the timeouts....

WernerMairl avatar Jul 15 '21 05:07 WernerMairl

Any news on this?

P.S. Maybe it should be some kind of method that would wait for a custom logic to complete before re-requesting the tiles one more time.

Or it might be something like this:

this.map.on('error', (e) => {
  // do some logic here
  this.map.requestFailedTiles();
 // or...
 this.map.failedTiles.request();
});

vladkasianenko avatar Jul 26 '22 18:07 vladkasianenko

Any news on this? It would be really great to have controll over the requests, especially for error handling and retrying

ivan-palatov avatar Oct 12 '22 04:10 ivan-palatov