staticmaps icon indicating copy to clipboard operation
staticmaps copied to clipboard

tileRequestLimit: limit concurrent connections

Open StephanGeorg opened this issue 4 years ago • 5 comments

Due to new limitations of the OSM tiles usage policy I added tilesRequestLimit in [email protected] option to limit concurrent connections to the tiles server. This value is set to 2 by default and can be overwritten or disabled with tilesRequestLimit: 0.

StephanGeorg avatar Mar 26 '20 13:03 StephanGeorg

@OlivierKamers FYI

StephanGeorg avatar Mar 26 '20 13:03 StephanGeorg

Nice 👍 I also saw the update to get rid of the request library. I played around with it a few weeks ago because we had issues parallelising multiple map renderings. I added an option to provide a custom tile loader function (so we can use our blob storage functions and some memoization) but it looks like the got library you're using now might already take care of the issues we had. I haven't been able to clean up the implementation yet so that's why I didn't propose the change here, and it's just on a branch in our fork: https://github.com/Sitemark/staticmaps/commit/5084341d87d19940659a8b59473f37088b546916

OlivierKamers avatar Mar 26 '20 13:03 OlivierKamers

What kind of issues?

StephanGeorg avatar Mar 26 '20 14:03 StephanGeorg

I had to limit the number of requests to avoid timeouts from the request library. Externalising the function also allowed me to use a cache for tiles that are requested more than once.

OlivierKamers avatar Mar 26 '20 14:03 OlivierKamers

Ok, that could indeed be an improvement. I thought for now caching should be done at the tiles server side, for example via CDN.

StephanGeorg avatar Mar 27 '20 08:03 StephanGeorg