From bd6733a1b7ef7b5910c14d22cba2a09164d7fbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Hern=C3=A1ndez?= Date: Tue, 7 Oct 2025 15:26:08 +0200 Subject: [PATCH] Remote Alertmanager: Pass the sync.WaitGroup to the goroutine as an argument --- .../ngalert/remote/remote_secondary_forked_alertmanager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/services/ngalert/remote/remote_secondary_forked_alertmanager.go b/pkg/services/ngalert/remote/remote_secondary_forked_alertmanager.go index c5b751cd336..9d8d0558bc4 100644 --- a/pkg/services/ngalert/remote/remote_secondary_forked_alertmanager.go +++ b/pkg/services/ngalert/remote/remote_secondary_forked_alertmanager.go @@ -131,7 +131,7 @@ func (fam *RemoteSecondaryForkedAlertmanager) ApplyConfig(ctx context.Context, c var wg sync.WaitGroup wg.Add(1) // Figure out if we need to sync the external Alertmanager in another goroutine. - go func() { + go func(wg sync.WaitGroup) { defer wg.Done() // If the Alertmanager has not been marked as "ready" yet, delegate the call to the remote Alertmanager. // This will perform a readiness check and sync the Alertmanagers. @@ -154,7 +154,7 @@ func (fam *RemoteSecondaryForkedAlertmanager) ApplyConfig(ctx context.Context, c } fam.log.Debug("Finished syncing configuration with the remote Alertmanager") } - }() + }(wg) if fam.shouldFetchRemoteState { wg.Wait()