diff --git a/x-pack/plugins/synthetics/server/alert_rules/status_rule/status_rule_executor.ts b/x-pack/plugins/synthetics/server/alert_rules/status_rule/status_rule_executor.ts index b2b3c8094ee6c..cba5a7d2128b3 100644 --- a/x-pack/plugins/synthetics/server/alert_rules/status_rule/status_rule_executor.ts +++ b/x-pack/plugins/synthetics/server/alert_rules/status_rule/status_rule_executor.ts @@ -49,7 +49,6 @@ export class StatusRuleExecutor { monitors: Array> = []; public locationIdNameMap: Record = {}; - public locationNameIdMap: Record = {}; constructor( previousStartedAt: Date | null, @@ -76,12 +75,10 @@ export class StatusRuleExecutor { publicLocations.forEach((loc) => { this.locationIdNameMap[loc.label] = loc.id; - this.locationNameIdMap[loc.id] = loc.label; }); privateLocations.forEach((loc) => { this.locationIdNameMap[loc.label] = loc.id; - this.locationIdNameMap[loc.id] = loc.label; }); } @@ -198,13 +195,10 @@ export class StatusRuleExecutor { delete downConfigs[locPlusId]; } else { const { locations } = monitor.attributes; - if ( - !locations.some( - (l) => - l.label === downConfig.location || - this.locationNameIdMap[l.id] === downConfig.location - ) - ) { + const isLocationRemoved = !locations.some( + (l) => l.id === this.getLocationId(downConfig.location) + ); + if (isLocationRemoved) { staleDownConfigs[locPlusId] = { ...downConfig, isLocationRemoved: true }; delete downConfigs[locPlusId]; }