mapbox / mapbox-sdk-cs

C# libraries for Mapbox API layer
https://mapbox.github.io/mapbox-sdk-cs/
Other
20 stars 11 forks source link

adding retry for tile requests #57

Open isiyu opened 7 years ago

isiyu commented 7 years ago

related to reporting errors https://github.com/mapbox/mapbox-sdk-cs/issues/55

can we also add a retry option to the parameters input to tile objects here? loading map tiles sometimes I've noticed one or two tiles time out and not load before. Would be helpful to have a retry option here. cc @BergWerkGIS @brnkhy

brnkhy commented 7 years ago

a quick idea would be;

var parameters = new Mapbox.Map.Tile.Parameters
            {
                Fs = this.FileSource,
                Id = new Mapbox.Map.CanonicalTileId(tile.Zoom, (int)tile.TileCoordinate.x, (int)tile.TileCoordinate.y),
                MapId = _mapId,
                RetryCount = 5 //optinal parameter, defaul can be something like 3?
            };

            var vectorTile = new Mapbox.Map.VectorTile();
            vectorTile.Initialize(parameters, () =>
...
david-rhodes commented 7 years ago

@isiyu is a retry count the proper solution? It seems to me that throwing errors and letting developers handle with their own solution is best (usually this will result in a retry). In most cases, I've seen tiles fail to load because of a rate request exceeded error. A blanket retry could lead to inefficient (and unnecessary) requests that might lead to additional errors. #55

brnkhy commented 7 years ago

@david-rhodes

In most cases, I've seen tiles fail to load because of a rate request exceeded error.

I think you're right. I can't remember any other type of fetching errors given the correct url. But we can also also trying dropping&re-requesting if it takes too long. It's just annoying when there's 1-2 tiles missing in there and there's nothing you can do about it. Guess we can handle that in unity side and keep checking and requesting missing tiles in view (slippy view or defined area).

isiyu commented 7 years ago

sounds like there's some conversations happening around retries here: https://github.com/mapbox/api/issues/30

Overall I think we can retry certain types of failures (mainly timeouts), things like rate limits or 4XX errors we would not retry. This would be focused on the 1-2 missing tiles issue.

The other issue that we're masking here is I'm not sure how we're handling timeouts on the unity-sdk (between the unity sdk and the cs sdk) side.

david-rhodes commented 7 years ago

I don't think we are handling timeouts at all. Good candidate to add as a feature when we overhaul the FileSource in Unity SDK.