Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 332bd7f560 | |||
| 10d6e90dfe | |||
| 0183f50cc8 |
@@ -1,4 +1,4 @@
|
||||
## Version 1.5.13
|
||||
## Version 1.5.16
|
||||
|
||||
### Bugfix
|
||||
- Fix EOF error by closing request
|
||||
|
||||
14
client.go
14
client.go
@@ -146,17 +146,17 @@ func (dc *DecortClient) do(req *http.Request) (*http.Response, error) {
|
||||
resp, err := dc.client.Do(req)
|
||||
req.Close = true
|
||||
if err != nil || resp == nil {
|
||||
if strings.Contains(err.Error(), "connection reset by peer") {
|
||||
resp.Body.Close()
|
||||
if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) {
|
||||
for i := uint64(0); i < dc.cfg.Retries; i++ {
|
||||
time.Sleep(5 * time.Second)
|
||||
resp, err = dc.client.Do(req)
|
||||
if strings.Contains(err.Error(), "connection reset by peer") {
|
||||
resp.Body.Close()
|
||||
continue
|
||||
} else if err == nil {
|
||||
if err == nil {
|
||||
break
|
||||
} else if err != nil {
|
||||
}
|
||||
if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,17 +147,17 @@ func (ldc *LegacyDecortClient) do(req *http.Request) (*http.Response, error) {
|
||||
resp, err := ldc.client.Do(req)
|
||||
req.Close = true
|
||||
if err != nil || resp == nil {
|
||||
if strings.Contains(err.Error(), "connection reset by peer") {
|
||||
resp.Body.Close()
|
||||
if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) {
|
||||
for i := uint64(0); i < ldc.cfg.Retries; i++ {
|
||||
time.Sleep(5 * time.Second)
|
||||
resp, err = ldc.client.Do(req)
|
||||
if strings.Contains(err.Error(), "connection reset by peer") {
|
||||
resp.Body.Close()
|
||||
continue
|
||||
} else if err == nil {
|
||||
if err == nil {
|
||||
break
|
||||
} else if err != nil {
|
||||
}
|
||||
if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user