Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose RetryClient in NetworkTileProvider initialisation #1297

Closed
wants to merge 6 commits into from

Conversation

MichalTorma
Copy link

This pull request adds optional parameter RetryClient for NetworkTileProvider. I made this fork to scratch my own itch with some stubborn tile servers that are either too slow or don't follow the standard conventions. Some servers require longer cooldown between the requests therefore more than 3 retries are needed (as was the default in NetworkImageWithRetry).

Copy link
Contributor

@ibrierley ibrierley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, out of interest, what would be a good example code that someone would use as the optional RetryClient ?

@MichalTorma
Copy link
Author

So, out of interest, what would be a good example code that someone would use as the optional RetryClient ?

Hi there,
Here is an example of layer definition that I needed for one open server that replies 200 every-time you ask for something, but response either contains png as one would expect, or content-type is different and error message (too many requests) is inside the response body. (don't as me why :D - It's Norwegian national cartography server...). I also needed to increase the number of retries because it is a bit sluggish...

        TileLayerOptions(
            tileProvider: NetworkTileProvider(
                retryClient: RetryClient(
              Client(),
              retries: 10,
              when: (p0) => p0.headers['content-type'] != 'image/png',
            )),
            wmsOptions: WMSTileLayerOptions(
                baseUrl: 'https://openwms.statkart.no/skwms1/wms.topo4?',
                layers: ['topo4_WMS'],
                version: '1.3.0',
                format: 'image/png',
                crs: const Epsg3857(),
                transparent: false)),

@JaffaKetchup
Copy link
Member

This will conflict with #1294, but it's not too much of an issue, so I'm happy for it to be merged ahead.

@JaffaKetchup
Copy link
Member

@MichalTorma Hi there,

I've had to make some unexpected changes to #1294, which includes the changes that PR made. You can see the commit which did this: ad2adb6.

As a result, I'm going to close this PR. Many thanks for your contribution, it's greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants