-
Notifications
You must be signed in to change notification settings - Fork 192
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
Cancelling requests #136
Comments
|
I suppose it'll have to wait at least for the abort api for whatwg-fetch is merged JakeChampion/fetch#592 |
|
Would also find this useful |
|
@furstenheim Is there anything we can do to make this happen? This would increase performance significantly when generating the vector tiles dynamically. |
|
@dbauszus-glx for now I'm waiting for the people from the fetch polyfill to implement the feature. I'll give it a try once they have it ready. |
|
Agreed. All our tiles are built on the fly from live data that is changing frequently so sometimes the backend can be a little slow in sending the tiles if it is busy. So you are viewing at zoom level 6, you zoom in to zoom level 7 (requests are fired) and then zoom back out again but zoom level 7 tiles then start to dribble in/block level 6 requests. If you are doing anything with the tile data once they are received it can sometimes mess up that process as well, so downstream effects like features from zoom level 7 get plotted at zoom level 6 etc. (but suggest that's more of an edge case issue) So super up vote from me. |
|
#151 should resolve this partly. There's a way to take this a step further by actually cancelling the requests using abort signals for fetch, but browser support is a little patchy to make it worth it. |
|
On my last note; we could potentially bundle an AbortController (i.e. abortable fetch) polyfill with Leaflet.VectorGrid? It would make sense (at least for the next year or two) as support is currently pretty low. This one could potentially work, and I think it might dramatically improve user experience. Thoughts @IvanSanchez @tomchadwin ? |
Will this catch anything beyond what you did in #151? I agree that we should implement |
|
@tomchadwin ah, yes that is a pain. Panning/zooming in turn makes a lot requests which is actually the bottleneck as browsers like Chrome are limited to 6 (fact check that!) concurrent requests. Closing the actual HTTP request prioritises the most recent/relevant tile requests. We could implement it behind feature detection, as shortly it will be supported by Chrome (next release). This in turn would mean Firefox, Edge and Chrome support which should cover about 60%+ of users with minimal impact on everyone else. |
|
Looks like a plan. My guess is that API maintainers will want to implement it ASAP anyway, given the saving on traffic. |
I've noticed that when using protobuf and changing the zoom, old requests aren't cancelled. This is sometimes clogging the server if the tiles take too long and the user changes zoom quick.
If it is of any help, in leaflet tile layers this is handled by changing the src of the img and that makes the browser cancel the old request https://github.com/Leaflet/Leaflet/blob/master/src/layer/tile/TileLayer.js#L230
Of course that won't work out here, since you are doing fetch directly.
Thanks
The text was updated successfully, but these errors were encountered: