Skip to content

Commit

Permalink
only call isRuleSnoozed() once; from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuellr committed Mar 23, 2022
1 parent 99f5e68 commit d865d70
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/alerting/server/task_runner/task_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ export class TaskRunner<
triggeredActionsStatus: ActionsCompletion.COMPLETE,
};

if (!this.isRuleSnoozed(rule) && this.shouldLogAndScheduleActionsForAlerts()) {
const ruleIsSnoozed = this.isRuleSnoozed(rule);
if (!ruleIsSnoozed && this.shouldLogAndScheduleActionsForAlerts()) {
const mutedAlertIdsSet = new Set(mutedInstanceIds);

const alertsWithExecutableActions = Object.entries(alertsWithScheduledActions).filter(
Expand Down Expand Up @@ -538,7 +539,7 @@ export class TaskRunner<
alertExecutionStore,
});
} else {
if (this.isRuleSnoozed(rule)) {
if (ruleIsSnoozed) {
this.logger.debug(`no scheduling of actions for rule ${ruleLabel}: rule is snoozed.`);
}
if (!this.shouldLogAndScheduleActionsForAlerts()) {
Expand Down

0 comments on commit d865d70

Please sign in to comment.