Skip to content

Commit

Permalink
slack: retry 429 errors
Browse files Browse the repository at this point in the history
Fix #2111

Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Nov 21, 2019
1 parent 4ec5356 commit 13dde06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion notify/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func New(c *config.SlackConfig, t *template.Template, l log.Logger) (*Notifier,
tmpl: t,
logger: l,
client: client,
retrier: &notify.Retrier{},
retrier: &notify.Retrier{RetryCodes: []int{http.StatusTooManyRequests}},
}, nil
}

Expand Down
4 changes: 3 additions & 1 deletion notify/slack/slack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package slack

import (
"fmt"
"net/http"
"testing"

"github.com/go-kit/kit/log"
Expand All @@ -35,7 +36,8 @@ func TestSlackRetry(t *testing.T) {
)
require.NoError(t, err)

for statusCode, expected := range test.RetryTests(test.DefaultRetryCodes()) {
retryCodes := append(test.DefaultRetryCodes(), http.StatusTooManyRequests)
for statusCode, expected := range test.RetryTests(retryCodes) {
actual, _ := notifier.retrier.Check(statusCode, nil)
require.Equal(t, expected, actual, fmt.Sprintf("error on status %d", statusCode))
}
Expand Down

0 comments on commit 13dde06

Please sign in to comment.