fix opsgenie retry handling logic error

Signed-off-by: Tomáš Freund <tomas.freund@datamole.cz>
This commit is contained in:
Tomáš Freund 2021-03-19 23:23:29 +01:00
parent 79dfb86c7b
commit adb69554a7
1 changed files with 4 additions and 5 deletions

View File

@ -97,14 +97,13 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
for _, req := range requests {
resp, err := n.client.Do(req)
notify.Drain(resp)
if err != nil {
return true, err
}
defer notify.Drain(resp)
success, err := n.retrier.Check(resp.StatusCode, resp.Body)
if !success {
return false, err
shouldRetry, err := n.retrier.Check(resp.StatusCode, resp.Body)
if err != nil {
return shouldRetry, err
}
}
return true, nil