retry failed messages

This commit is contained in:
Niko Storni 2022-09-27 22:48:51 +02:00
parent 014adbb315
commit 5f52a995a7

View file

@ -79,7 +79,13 @@ func sendToSlack(channel, username, message string) error {
err = errors.Err("no slack token provided") err = errors.Err("no slack token provided")
} else { } else {
log.Debugln("slack: " + channel + ": " + message) log.Debugln("slack: " + channel + ": " + message)
_, _, err = slackApi.PostMessage(channel, slack.MsgOptionText(message, false), slack.MsgOptionUsername(username)) for {
_, _, err = slackApi.PostMessage(channel, slack.MsgOptionText(message, false), slack.MsgOptionUsername(username))
if strings.Contains(err.Error(), "timeout awaiting response headers") {
continue
}
break
}
} }
if err != nil { if err != nil {