From b3d61c10d72e5c48d38431887a4cbc34f9ee1e5b Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 1 Feb 2024 16:39:03 +0100 Subject: [PATCH] check to rules ids --- x-pack/plugins/ml/server/models/job_service/jobs.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/ml/server/models/job_service/jobs.ts b/x-pack/plugins/ml/server/models/job_service/jobs.ts index 578e48b2d2884..87a719816896a 100644 --- a/x-pack/plugins/ml/server/models/job_service/jobs.ts +++ b/x-pack/plugins/ml/server/models/job_service/jobs.ts @@ -108,9 +108,11 @@ export function jobsProvider( }) .map((rule) => rule.id); - await rulesClient.bulkDeleteRules({ - ids: ruleIds, - }); + if (ruleIds.length > 0) { + await rulesClient.bulkDeleteRules({ + ids: ruleIds, + }); + } } for (const jobId of jobIds) {