From 5a1842635dea256ac8ffecec15c2fe98b5100e59 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 20 Jun 2022 10:11:46 -0400 Subject: [PATCH] Alerting: Use ErrImagesDone in Discord and SensuGo (#51106) (#51125) (cherry picked from commit 7235480be5ef1a4a0810a5310c1f8e4a813e8bab) Co-authored-by: George Robinson --- pkg/services/ngalert/notifier/channels/discord.go | 3 +-- pkg/services/ngalert/notifier/channels/sensugo.go | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/services/ngalert/notifier/channels/discord.go b/pkg/services/ngalert/notifier/channels/discord.go index 7bb82b754ec..48fac488c71 100644 --- a/pkg/services/ngalert/notifier/channels/discord.go +++ b/pkg/services/ngalert/notifier/channels/discord.go @@ -201,8 +201,7 @@ func (d DiscordNotifier) constructAttachments(ctx context.Context, as []*types.A _ = withStoredImages(ctx, d.log, d.images, func(index int, image *ngmodels.Image) error { if embedQuota < 1 { - // TODO: Could be a sentinel error to stop execution. - return nil + return ErrImagesDone } if image == nil { diff --git a/pkg/services/ngalert/notifier/channels/sensugo.go b/pkg/services/ngalert/notifier/channels/sensugo.go index 1f9a656fd57..35726d3ab8c 100644 --- a/pkg/services/ngalert/notifier/channels/sensugo.go +++ b/pkg/services/ngalert/notifier/channels/sensugo.go @@ -147,6 +147,7 @@ func (sn *SensuGoNotifier) Notify(ctx context.Context, as ...*types.Alert) (bool // one image per request. if image != nil && image.URL != "" && imageURL == "" { imageURL = image.URL + return ErrImagesDone } return nil }, as...)