Skip to content

Commit

Permalink
slack: notification error log
Browse files Browse the repository at this point in the history
The commit improves log during notification error.

Signed-off-by: viktor-kurchenko <[email protected]>
  • Loading branch information
viktor-kurchenko committed Jan 29, 2025
1 parent ac657a5 commit 3ab8d24
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"time"
"unicode/utf8"

"c7n-helper/pkg/log"

"github.com/slack-go/slack"
)

Expand Down Expand Up @@ -162,6 +164,7 @@ func (s *slackProvider) notify(ctx context.Context, channelMessages map[string][
for _, message := range messages {
_, _, _, err := s.client.SendMessageContext(ctx, channel, slack.MsgOptionText(message, false))
if err != nil {
log.FromContext(ctx).Errorf("channel [%s] notification error (check if C7N bot invited!): %s", channel, err)
return err
}
time.Sleep(time.Millisecond * 150) // pause to avoid slack rate limits
Expand Down

0 comments on commit 3ab8d24

Please sign in to comment.