Skip to content

Commit 754385a

Browse files
Merge pull request #23 from observeinc/fix-retryable-errors
Fixes retryable errors.
2 parents d438c4e + 1a7a190 commit 754385a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

retry.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package gosnowflake
55
import (
66
"bytes"
77
"context"
8+
"errors"
89
"fmt"
910
"io"
1011
"math"
@@ -390,6 +391,13 @@ func (r *retryHTTP) execute() (res *http.Response, err error) {
390391
}
391392

392393
func isRetryableError(req *http.Request, res *http.Response, err error) (bool, error) {
394+
if errors.Is(err, context.DeadlineExceeded) {
395+
// Don't retry and return an unwrapped DeadlineExceeded error
396+
return false, context.DeadlineExceeded
397+
} else if errors.Is(err, context.Canceled) {
398+
// Don't retry and return an unwrapped Canceled error
399+
return false, context.Canceled
400+
}
393401
if err != nil && res == nil { // Failed http connection. Most probably client timeout.
394402
return true, err
395403
}

0 commit comments

Comments
 (0)