Skip to content
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 @@ -95,6 +95,7 @@ export class JobsListView extends Component {

componentWillUnmount() {
timefilter.off('refreshIntervalUpdate');
deletingJobsRefreshTimeout = null;
this.clearRefreshInterval();
}

Expand Down Expand Up @@ -126,7 +127,7 @@ export class JobsListView extends Component {
} else {
this.setRefreshInterval(value);
}
this.refreshJobSummaryList(true);
this.refreshJobSummaryList();
}

setRefreshInterval(interval) {
Expand Down Expand Up @@ -317,7 +318,7 @@ export class JobsListView extends Component {
// if there are some jobs in a deleting state, start polling for
// deleting jobs so we can update the jobs list once the
// deleting tasks are over
this.checkDeletingJobTasks();
this.checkDeletingJobTasks(forceRefresh);
}
} catch (error) {
console.error(error);
Expand All @@ -326,17 +327,22 @@ export class JobsListView extends Component {
}
}

async checkDeletingJobTasks() {
const { jobIds } = await ml.jobs.deletingJobTasks();
async checkDeletingJobTasks(forceRefresh = false) {
const { jobIds: taskJobIds } = await ml.jobs.deletingJobTasks();

if (jobIds.length === 0 || isEqual(jobIds.sort(), this.state.deletingJobIds.sort())) {
this.setState({
deletingJobIds: jobIds,
});
this.refreshJobSummaryList(true);
const taskListHasChanged = (isEqual(taskJobIds.sort(), this.state.deletingJobIds.sort()) === false);

this.setState({
deletingJobIds: taskJobIds,
});

// only reload the jobs list if the contents of the task list has changed
// or the check refresh has been forced i.e. from a user action
if (taskListHasChanged || forceRefresh) {
this.refreshJobSummaryList();
}

if (jobIds.length > 0 && deletingJobsRefreshTimeout === null) {
if (taskJobIds.length > 0 && deletingJobsRefreshTimeout === null) {
deletingJobsRefreshTimeout = setTimeout(() => {
deletingJobsRefreshTimeout = null;
this.checkDeletingJobTasks();
Expand Down