From 584db08131787fffb3f136c9faeed00e78366a49 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Tue, 12 Mar 2024 14:02:05 +0000 Subject: [PATCH] adding constant --- x-pack/plugins/ml/common/constants/jobs_list.ts | 1 + .../jobs/jobs_list/components/jobs_list_view/jobs_list_view.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/ml/common/constants/jobs_list.ts b/x-pack/plugins/ml/common/constants/jobs_list.ts index 8ebabdf2ccaf3..76cb0d83c7923 100644 --- a/x-pack/plugins/ml/common/constants/jobs_list.ts +++ b/x-pack/plugins/ml/common/constants/jobs_list.ts @@ -9,5 +9,6 @@ export const DEFAULT_REFRESH_INTERVAL_MS = 30000; export const MINIMUM_REFRESH_INTERVAL_MS = 1000; export const BLOCKED_JOBS_REFRESH_INTERVAL_MS = 2000; export const BLOCKED_JOBS_REFRESH_INTERVAL_SLOW_MS = 120000; // 2mins +export const BLOCKED_JOBS_REFRESH_THRESHOLD_MS = 60000; // 1min export const RESETTING_JOBS_REFRESH_INTERVAL_MS = 1000; export const PROGRESS_JOBS_REFRESH_INTERVAL_MS = 2000; diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js index c2ed8ddf3f24e..40df5bd90915b 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js @@ -29,6 +29,7 @@ import { UpgradeWarning } from '../../../../components/upgrade'; import { BLOCKED_JOBS_REFRESH_INTERVAL_MS, BLOCKED_JOBS_REFRESH_INTERVAL_SLOW_MS, + BLOCKED_JOBS_REFRESH_THRESHOLD_MS, } from '../../../../../../common/constants/jobs_list'; import { JobListMlAnomalyAlertFlyout } from '../../../../../alerting/ml_alerting_flyout'; import { StopDatafeedsConfirmModal } from '../confirm_modals/stop_datafeeds_confirm_modal'; @@ -401,7 +402,7 @@ export class JobsListView extends Component { getBlockedJobsRefreshInterval() { const runningTimeMs = Date.now() - this.state.blockingJobsFirstFoundMs; - if (runningTimeMs > 60000) { + if (runningTimeMs > BLOCKED_JOBS_REFRESH_THRESHOLD_MS) { // if the jobs have been in a blocked state for more than a minute // increase the polling interval return BLOCKED_JOBS_REFRESH_INTERVAL_SLOW_MS;