diff --git a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts index 87148f9e1a4145..91d30fae7b3dc9 100644 --- a/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts +++ b/x-pack/plugins/rule_registry/server/utils/create_lifecycle_executor.ts @@ -401,14 +401,7 @@ export const createLifecycleExecutor = const flapping = isFlapping(flappingSettings, flappingHistory, isCurrentlyFlapping); return [ alertId, - { - alertId, - alertUuid, - started, - flappingHistory, - flapping, - pendingRecoveredCount, - }, + { alertId, alertUuid, started, flappingHistory, flapping, pendingRecoveredCount }, ]; }) ); @@ -430,14 +423,7 @@ export const createLifecycleExecutor = const flapping = isFlapping(flappingSettings, flappingHistory, isCurrentlyFlapping); return [ alertId, - { - alertId, - alertUuid, - started, - flappingHistory, - flapping, - pendingRecoveredCount, - }, + { alertId, alertUuid, started, flappingHistory, flapping, pendingRecoveredCount }, ]; }) ); diff --git a/x-pack/plugins/rule_registry/server/utils/get_alerts_for_notification.ts b/x-pack/plugins/rule_registry/server/utils/get_alerts_for_notification.ts index 8e0df34587762a..878db2a9180227 100644 --- a/x-pack/plugins/rule_registry/server/utils/get_alerts_for_notification.ts +++ b/x-pack/plugins/rule_registry/server/utils/get_alerts_for_notification.ts @@ -21,8 +21,11 @@ export function getAlertsForNotification( return trackedEventsToIndex.map((trackedEvent) => { if (!flappingSettings.enabled || trackedEvent.event[ALERT_STATUS] === ALERT_STATUS_ACTIVE) { trackedEvent.pendingRecoveredCount = 0; - } else if (trackedEvent.event[ALERT_STATUS] === ALERT_STATUS_RECOVERED) { - if (flappingSettings.enabled && trackedEvent.flapping) { + } else if ( + flappingSettings.enabled && + trackedEvent.event[ALERT_STATUS] === ALERT_STATUS_RECOVERED + ) { + if (trackedEvent.flapping) { const count = trackedEvent.pendingRecoveredCount || 0; trackedEvent.pendingRecoveredCount = count + 1; if (trackedEvent.pendingRecoveredCount < flappingSettings.statusChangeThreshold) {