From 0f3bbf6368bb0db76323b3275ab78e66f156f955 Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Wed, 15 Dec 2021 18:37:48 +0800 Subject: [PATCH] use NotifyRepeatNext as TriggerTime when repeat notify --- Makefile | 2 +- docker/docker-compose.yaml | 4 ++-- src/server/engine/repeat.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index bec59488..45cc6b97 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ NOW = $(shell date -u '+%Y%m%d%I%M%S') -RELEASE_VERSION = 5.0.0-ga-06 +RELEASE_VERSION = 5.1.0 APP = n9e SERVER_BIN = $(APP) diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 915b8abf..ec173520 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -79,7 +79,7 @@ services: - "server" nwebapi: - image: ulric2019/nightingale:5.0.0-ga-06 + image: ulric2019/nightingale:5.1.0 container_name: nwebapi hostname: nwebapi restart: always @@ -107,7 +107,7 @@ services: - "webapi" nserver: - image: ulric2019/nightingale:5.0.0-ga-06 + image: ulric2019/nightingale:5.1.0 container_name: nserver hostname: nserver restart: always diff --git a/src/server/engine/repeat.go b/src/server/engine/repeat.go index 61d2bdce..5791be37 100644 --- a/src/server/engine/repeat.go +++ b/src/server/engine/repeat.go @@ -48,6 +48,14 @@ func repeat() { event.DB2Mem() + // 重复通知的告警,应该用新的时间来判断是否生效和是否屏蔽, + // 不能使用TriggerTime,因为TriggerTime是触发时的时间, + // 先发了告警,又做了屏蔽,本质是不想发了,如果继续用TriggerTime判断 + // 就还是会发,不符合预期,所以,这里伪装一下TriggerTime, + // 判断完了再卸掉伪装 + realTriggerTime := event.TriggerTime + event.TriggerTime = event.NotifyRepeatNext + if isNoneffective(event.TriggerTime, rule) { continue } @@ -56,6 +64,8 @@ func repeat() { continue } + event.TriggerTime = realTriggerTime + fillUsers(event) notify(event)