Adding exception for EOF error. All EOF errors will be retried.
This commit is contained in:
parent
b66a1422ce
commit
f37e455852
1 changed files with 6 additions and 5 deletions
11
retry.go
11
retry.go
|
@ -15,6 +15,7 @@
|
||||||
package realis
|
package realis
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
@ -90,7 +91,6 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
// If the error is temporary, continue retrying.
|
// If the error is temporary, continue retrying.
|
||||||
if !IsTemporary(err) {
|
if !IsTemporary(err) {
|
||||||
return err
|
return err
|
||||||
|
@ -98,9 +98,7 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc)
|
||||||
// Print out the temporary error we experienced.
|
// Print out the temporary error we experienced.
|
||||||
logger.Println(err)
|
logger.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if curStep > 1 {
|
if curStep > 1 {
|
||||||
|
@ -167,8 +165,11 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
|
||||||
|
|
||||||
e, ok := e.Err().(*url.Error)
|
e, ok := e.Err().(*url.Error)
|
||||||
if ok {
|
if ok {
|
||||||
if !IsTemporary(e) {
|
// EOF error occurs when the server closes the read buffer of the client. This is common
|
||||||
return nil, errors.Wrap(clientErr, "Non-temporary connection error")
|
// when the server is overloaded and should be retried. All other errors that are permanent
|
||||||
|
// will not be retried.
|
||||||
|
if e.Err != io.EOF && !IsTemporary(e) {
|
||||||
|
return nil, errors.Wrap(clientErr, "Permanent connection error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue