Replaced temporary http error with timeout

This commit is contained in:
Quentin Renard
2022-10-11 11:11:26 +02:00
parent 07596dbc01
commit d19d98de91

View File

@@ -156,7 +156,7 @@ func (s *HTTPSender) SendWithTimeout(req *http.Request, timeout time.Duration) (
s.l.Debugf("astikit: sending %s", nr)
if resp, err = s.client.Do(req); err != nil {
// Retry if error is temporary, stop here otherwise
if netError, ok := err.(net.Error); !ok || !netError.Temporary() {
if netError, ok := err.(net.Error); !ok || !netError.Timeout() {
err = fmt.Errorf("astikit: sending %s failed: %w", nr, err)
return
}