From 4478259f70cae52f76ab6b3002ceae8a14bb3aba Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 26 Jul 2021 15:42:31 +0200 Subject: [PATCH] Alerting: Remove the fixed wait for notification delivery (#37203) (#37207) Signed-off-by: Ganesh Vernekar (cherry picked from commit a65975cca056d35e37bb3facc7ec6077a6831e7b) Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> --- pkg/services/ngalert/notifier/alertmanager.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/services/ngalert/notifier/alertmanager.go b/pkg/services/ngalert/notifier/alertmanager.go index 3aced9ec938..5ba1d72cfe9 100644 --- a/pkg/services/ngalert/notifier/alertmanager.go +++ b/pkg/services/ngalert/notifier/alertmanager.go @@ -661,7 +661,12 @@ func (am *Alertmanager) createReceiverStage(name string, integrations []notify.I } func waitFunc() time.Duration { - return setting.AlertingNotificationTimeout + // When it's a single instance, we don't need additional wait. The routing policies will have their own group wait. + // We need >0 wait here in case we have peers to sync the notification state with. 0 wait in that case can result + // in duplicate notifications being sent. + // TODO: we have setting.AlertingNotificationTimeout in legacy settings. Either use that or separate set of config + // for clustering with intuitive name, like "PeerTimeout". + return 0 } func timeoutFunc(d time.Duration) time.Duration {