Allow the fetch queue to have an initial size. #1000
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the concept of an initial queue size to the fetch queue. Once the initial queue size requests have been satisfied, then the regular queue size is used unless the initial queue size is reapplied.
For tile layers, the queue size and initial queue size can now be specified directly, rather than reaching in to the _queue property and modifying the queue there.
The default queue size remains at 6. This value corresponds to most browsers using a maximum of 6 requests per domain. If a tile source with subdomains is used, this could be increased to 6 * (number of subdomains). There doesn't seem to be any measurable improvement doing so with the default osm tile source, though.
The default is not to use an initial queue size. However, when using tile servers that cache open tile sources and need time to serve the first tile when not in cache, using an initial queue size of 1 can reduce server load, as the tile server will get a single request, serve it, and then get 6 simultaneous requests thereafter.