Skip to content
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

[chore] Improve request cancelation handling in vis embeddable #65057

Merged
merged 2 commits into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,14 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
this.abortController.abort();
}
this.abortController = new AbortController();
const abortController = this.abortController;
Copy link
Member

@ppisljar ppisljar May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why creating local variable ? if we have it lets use it everywhere, but without it this can be a one line PR.

Copy link
Contributor Author

@Dosant Dosant May 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local variable here is needed as a reference to previous abortController instance.
when await buildPipeline is finished, in case it was aborted, this.abortController would be a reference from next request

this.expression = await buildPipeline(this.vis, {
timefilter: this.timefilter,
timeRange: this.timeRange,
abortSignal: this.abortController!.signal,
});

if (this.handler) {
if (this.handler && !abortController.signal.aborted) {
this.handler.update(this.expression, expressionParams);
}
}
Expand Down