-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow limiting number of concurrent vector tile requests to prevent exhaustion of browser resources #13247
Open
jobblefrobble
wants to merge
34
commits into
mapbox:main
Choose a base branch
from
continuum-industries:sync-to-upstream
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+293
−46
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lback for a request that has actually been cancelled
… make array buffer generation an injected prop for testing
…quest-queue Adding vector tile request queue
…-queued-vector-tiles Add tests for queueing vector tiles
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Launch Checklist
@mapbox/map-design-team
@mapbox/static-apis
if this PR includes style spec API or visual changes.@mapbox/gl-native
if this PR includes shader changes or needs a native port.Issue
This PR is to resolve an issue I raised around high numbers of vector tile sources on the map causing browser resources to be exhausted. Causing some tile requests to fail to be sent, and also any other concurrent requests from the browser to be stopped too.
Issue is here
Fix
The PR introduces a request queue for the loading of vector tiles, following the pattern used for fetching images (
getImage
insrc/util/ajax.ts
).The solution is made slightly more complex than the image fetching by the inclusion of existing deduplication logic in the vector tile fetching.
Help needed
Currently the queue limit is hardcoded to
50
.I had intended to set this as global config in a similar way to the image fetching
mapboxgl.maxParallelImageRequests = 10
- however because the vector tile fetching mostly happens inside workers, it seemed like that the user-supplied config value was not being picked up.If there's an established pattern for injecting config into the workers I would like to follow that! Otherwise any general guidance would be much appreciated 🙇