From 65dbb895da85dde69748feae69c363fefcb89677 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 22 Jul 2021 10:51:58 +0200 Subject: [PATCH] [ML] fix job and datafeed states check, add comments --- .../ml/server/lib/alerts/jobs_health_service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.ts b/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.ts index 63ca23b424851..db4907decc3f0 100644 --- a/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.ts +++ b/x-pack/plugins/ml/server/lib/alerts/jobs_health_service.ts @@ -75,7 +75,7 @@ export function jobsHealthServiceProvider( return { /** - * Gets not started datafeeds and not opened jobs for provided jobs selection. + * Gets not started datafeeds for opened jobs. * @param jobIds */ async getNotStartedDatafeeds(jobIds: string[]): Promise { @@ -104,10 +104,10 @@ export function jobsHealthServiceProvider( job_state: jobState, }; }) - .filter( - (datafeedStat) => - datafeedStat.state !== 'started' || datafeedStat.job_state !== 'opened' - ); + .filter((datafeedStat) => { + // Find opened jobs with not started datafeeds + return datafeedStat.job_state === 'opened' && datafeedStat.state !== 'started'; + }); } }, /**