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

[ML] Fixing unnecessary deleting job polling #73087

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 @@ -63,9 +63,14 @@ export class JobsListView extends Component {
this.showDeleteJobModal = () => {};
this.showStartDatafeedModal = () => {};
this.showCreateWatchFlyout = () => {};
// work around to keep track of whether the component is mounted
// used to block timeouts for results polling
// which can run after unmounting
this._isMounted = false;
}

componentDidMount() {
this._isMounted = true;
this.refreshJobSummaryList(true);

if (this.props.isManagementTable !== true) {
Expand All @@ -87,6 +92,7 @@ export class JobsListView extends Component {
if (this.props.isManagementTable === undefined) {
deletingJobsRefreshTimeout = null;
}
this._isMounted = false;
}

openAutoStartDatafeedModal() {
Expand Down Expand Up @@ -232,7 +238,7 @@ export class JobsListView extends Component {
};

async refreshJobSummaryList(forceRefresh = false) {
if (forceRefresh === true || this.props.blockRefresh !== true) {
if (this._isMounted && (forceRefresh === true || this.props.blockRefresh !== true)) {
// Set loading to true for jobs_list table for initial job loading
if (this.state.loading === null) {
this.setState({ loading: true });
Expand Down Expand Up @@ -283,6 +289,10 @@ export class JobsListView extends Component {
}

async checkDeletingJobTasks(forceRefresh = false) {
if (this._isMounted === false) {
return;
}

const { jobIds: taskJobIds } = await ml.jobs.deletingJobTasks();

const taskListHasChanged =
Expand Down