[Maps] cancel SearchSource fetches that are no longer needed.#44436
[Maps] cancel SearchSource fetches that are no longer needed.#44436nreese merged 13 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-gis |
💚 Build Succeeded |
💚 Build Succeeded |
💚 Build Succeeded |
That error is displayed by courier when requests are canceled and outside the scope of this PR. Issue tracked in issue #44738 |
@lukasolson This behaviour is the result of a bug in map embeddable and the component not getting cleaned up. I opened #45183 to fix the bug and will ping you for another review once that PR is merged. |
💚 Build Succeeded |
|
@lukasolson #45183 is merged and this PR is ready for review |
💚 Build Succeeded |
💚 Build Succeeded |
lukasolson
left a comment
There was a problem hiding this comment.
LGTM, tested in Chrome and seems to be properly aborting requests. One minor thing I noticed is that sometimes if you have multiple layers and hit refresh several times, then some of the layers display a warning symbol until it loads. We might want to add special handling of aborted request errors there:
Thanks for reviewing this PR so thoroughly and finding this behavior. This is caused because the current implementation shallows AbortErrors to early and returns a response of I have updated the PR to bubble up the |
💚 Build Succeeded |
💚 Build Succeeded |
💚 Build Succeeded |
kindsun
left a comment
There was a problem hiding this comment.
Thanks for moving the callback tracking to the store. Much nicer. lgtm!
- code review
- tested locally
…c#44436) * [Maps] cancel SearchSource fetch on new request and destroy * cancel requests on layer delete and map unmount * use delete function to unregister cancel callback * review feedback * move cancelRequest to action * bubble request abort error up to caller
#46199) * [Maps] cancel SearchSource fetch on new request and destroy * cancel requests on layer delete and map unmount * use delete function to unregister cancel callback * review feedback * move cancelRequest to action * bubble request abort error up to caller



SearchSource and courier now contain the infrastructure needed to cancel in-flight
_searchresults. This is great because there are lots of actions that will negate the need for an in-flight SearchSource fetch. These include panning/zooming the map to new areas, changing query context, removing layers, and leaving a map. The Maps application needs to cancel in-flight SearchSource fetches that are no longer needed to avoid causing pressure on Elasticsearch nodes.