slack: retry 429 errors (#2112)
Fix #2111 Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
4ec53566e5
commit
26cc96a787
|
@ -49,7 +49,7 @@ func New(c *config.SlackConfig, t *template.Template, l log.Logger) (*Notifier,
|
||||||
tmpl: t,
|
tmpl: t,
|
||||||
logger: l,
|
logger: l,
|
||||||
client: client,
|
client: client,
|
||||||
retrier: ¬ify.Retrier{},
|
retrier: ¬ify.Retrier{RetryCodes: []int{http.StatusTooManyRequests}},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ package slack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-kit/kit/log"
|
"github.com/go-kit/kit/log"
|
||||||
|
@ -35,7 +36,8 @@ func TestSlackRetry(t *testing.T) {
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
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)
|
actual, _ := notifier.retrier.Check(statusCode, nil)
|
||||||
require.Equal(t, expected, actual, fmt.Sprintf("error on status %d", statusCode))
|
require.Equal(t, expected, actual, fmt.Sprintf("error on status %d", statusCode))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue