[8.11] [ML] Fixing blocked jobs polling interval (#171878) (#171885)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[ML] Fixing blocked jobs polling interval
(#171878)](https://github.com/elastic/kibana/pull/171878)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"James
Gowdy","email":"jgowdy@elastic.co"},"sourceCommit":{"committedDate":"2023-11-23T17:56:19Z","message":"[ML]
Fixing blocked jobs polling interval (#171878)\n\nThere is a bug with
the way we check whether or not to start polling for\r\nblocked jobs. We
should only start polling there isn't an existing
poll\r\nrunning.\r\nThis causes the polling to run as possible and to
refresh the full jobs\r\nlist on every check.\r\nNow the blocked jobs
polling correctly runs at the interval of 2s and\r\nthe full jobs list
is only updated when there is a change in the list of\r\nblocked
jobs.\r\n\r\nPartially fixes
https://github.com/elastic/kibana/issues/171626\r\n\r\nA more in-depth
change as specified in the issue can be done in follow\r\nup work. It's
good to get this change in for the next release just in\r\ncase we run
out of time for the larger
change.","sha":"e7c793e0d74f2c48c788e7daf37dfc3b7cd68c9f","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Anomaly
Detection","v8.12.0","v8.11.2"],"number":171878,"url":"https://github.com/elastic/kibana/pull/171878","mergeCommit":{"message":"[ML]
Fixing blocked jobs polling interval (#171878)\n\nThere is a bug with
the way we check whether or not to start polling for\r\nblocked jobs. We
should only start polling there isn't an existing
poll\r\nrunning.\r\nThis causes the polling to run as possible and to
refresh the full jobs\r\nlist on every check.\r\nNow the blocked jobs
polling correctly runs at the interval of 2s and\r\nthe full jobs list
is only updated when there is a change in the list of\r\nblocked
jobs.\r\n\r\nPartially fixes
https://github.com/elastic/kibana/issues/171626\r\n\r\nA more in-depth
change as specified in the issue can be done in follow\r\nup work. It's
good to get this change in for the next release just in\r\ncase we run
out of time for the larger
change.","sha":"e7c793e0d74f2c48c788e7daf37dfc3b7cd68c9f"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/171878","number":171878,"mergeCommit":{"message":"[ML]
Fixing blocked jobs polling interval (#171878)\n\nThere is a bug with
the way we check whether or not to start polling for\r\nblocked jobs. We
should only start polling there isn't an existing
poll\r\nrunning.\r\nThis causes the polling to run as possible and to
refresh the full jobs\r\nlist on every check.\r\nNow the blocked jobs
polling correctly runs at the interval of 2s and\r\nthe full jobs list
is only updated when there is a change in the list of\r\nblocked
jobs.\r\n\r\nPartially fixes
https://github.com/elastic/kibana/issues/171626\r\n\r\nA more in-depth
change as specified in the issue can be done in follow\r\nup work. It's
good to get this change in for the next release just in\r\ncase we run
out of time for the larger
change.","sha":"e7c793e0d74f2c48c788e7daf37dfc3b7cd68c9f"}},{"branch":"8.11","label":"v8.11.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
Kibana Machine 2023-11-23 14:04:55 -05:00 committed by GitHub
parent 1911e66972
commit ab76b27933
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -350,7 +350,10 @@ export class JobsListView extends Component {
});
this.isDoneRefreshing();
if (jobsSummaryList.some((j) => j.blocked !== undefined)) {
if (
blockingJobsRefreshTimeout === null &&
jobsSummaryList.some((j) => j.blocked !== undefined)
) {
// 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