Skip to content

Commit

Permalink
Fix too specific error handling in http WaitUntilReady
Browse files Browse the repository at this point in the history
  • Loading branch information
MeneDev committed Aug 18, 2019
1 parent 290309f commit 25cae74
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions wait/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import (
"fmt"
"net"
"net/http"
"os"
"strconv"
"syscall"
"time"

"github.com/docker/go-connections/nat"
Expand Down Expand Up @@ -80,7 +78,6 @@ func (ws *HTTPStrategy) WithAllowInsecure(allowInsecure bool) *HTTPStrategy {
func ForHTTP(path string) *HTTPStrategy {
return NewHTTPStrategy(path)
}

// WaitUntilReady implements Strategy.WaitUntilReady
func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) (err error) {
// limit context to startupTimeout
Expand Down Expand Up @@ -133,15 +130,8 @@ func (ws *HTTPStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge
resp, err := client.Do(req)

if err != nil {
if v, ok := err.(*net.OpError); ok {
if v2, ok := (v.Err).(*os.SyscallError); ok {
if v2.Err == syscall.ECONNREFUSED {
time.Sleep(100 * time.Millisecond)
continue
}
}
}
return err
time.Sleep(100 * time.Millisecond)
continue
}

if !ws.StatusCodeMatcher(resp.StatusCode) {
Expand Down

0 comments on commit 25cae74

Please sign in to comment.