Lazily retry triggered alerts in case of failure

This commit is contained in:
TwinProduction committed 2021-01-21 16:14:32 -05:00
1 parent e9ac115a95
commit 3204a79eb6
4 files changed
+162 -213

No files matched your search

+4
View File
@@ -2,6 +2,7 @@ package custom
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"net/http"
@@ -76,6 +77,9 @@ func (provider *AlertProvider) buildHTTPRequest(serviceName, alertDescription st
// Send a request to the alert provider and return the body
func (provider *AlertProvider) Send(serviceName, alertDescription string, resolved bool) ([]byte, error) {
if os.Getenv("MOCK_ALERT_PROVIDER") == "true" {
if os.Getenv("MOCK_ALERT_PROVIDER_ERROR") == "true" {
return nil, errors.New("error")
}
return []byte("{}"), nil
}
request := provider.buildHTTPRequest(serviceName, alertDescription, resolved)