-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Sessions] Extract search abort controllers logic into a separate class #95688
[Sessions] Extract search abort controllers logic into a separate class #95688
Conversation
Pinging @elastic/kibana-app-services (Team:AppServices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach makes sense to me... So in the search interceptor, if we get a cached observable, then we'd just addAbortSignal
and return?
} | ||
} | ||
|
||
private abortHandler() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: So you don't have to do line 23
private abortHandler() { | |
private abortHandler = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lukas pointed this out to avoid:
this.boundAbortHandler = this.abortHandler.bind(this);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
x-pack/plugins/data_enhanced/public/search/search_interceptor.ts
Outdated
Show resolved
Hide resolved
…act-search-abort-controller
…act-search-abort-controller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Needed for #92439 as it requires merging abort signals of multiple instances of cached requests.
Could you elaborate, please? Maybe a short sample how it will be used will be helpful?
Will we store a searchAbortController instance as part of a cache?
x-pack/plugins/data_enhanced/public/search/search_abort_controller.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
tested cancelations using Discover and Dashboard using slow network and shard delay
Didn't notice any user-facing changes
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @lizozom |
…ss (elastic#95688) * simplify abort controller logic and extract it into a class * docs * delete unused tests * code review * code review * code review
…ss (#95688) (#95779) * simplify abort controller logic and extract it into a class * docs * delete unused tests * code review * code review * code review Co-authored-by: Liza Katz <[email protected]>
Summary
Extract search abort controllers logic from the search interceptors into a separate class.
Needed for #92439 as it requires merging abort signals of multiple instances of cached requests.
Explanation
Aborting a cached search$ will now potentially depend on multiple abort signals (As described in #92439 (comment)).
To handle that, we will store the
SearchAbortController
in the cache, alongside the observable.When a response will be returned from cache, we will use the
addAbortSignal
to make sure we abort the underlying search only when all consumers abort it.Checklist
Delete any items that are not applicable to this PR.
For maintainers