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 { for _, req := range requests {
resp, err := n.client.Do(req) resp, err := n.client.Do(req)
notify.Drain(resp)
if err != nil { if err != nil {
return true, err return true, err
} }
defer notify.Drain(resp) shouldRetry, err := n.retrier.Check(resp.StatusCode, resp.Body)
if err != nil {
success, err := n.retrier.Check(resp.StatusCode, resp.Body) return shouldRetry, err
if !success {
return false, err
} }
} }
return true, nil return true, nil