Browse Source

Disable timeout by default

renovate/configure
Yota Toyama 8 years ago
parent
commit
69b2e396ac
  1. 8
      arguments.go
  2. 5
      url_checker.go

8
arguments.go

@ -27,7 +27,7 @@ Usage:
Options:
-c, --concurrency <num-requests> Set max number of concurrent HTTP requests [default: %v]
-t, --timeout <timeout> Set timeout for HTTP requests in seconds [default: 5]
-t, --timeout <timeout> Set timeout for HTTP requests in seconds
-v, --verbose Be verbose`
type arguments struct {
@ -50,11 +50,15 @@ func getArgs() (arguments, error) {
return arguments{}, err
}
t, err := strconv.ParseFloat(args["--timeout"].(string), 64)
t := 0.0
if args["--timeout"] != nil {
t, err = strconv.ParseFloat(args["--timeout"].(string), 64)
if err != nil {
return arguments{}, err
}
}
return arguments{
args["<filenames>"].([]string),

5
url_checker.go

@ -20,6 +20,11 @@ func (c urlChecker) Check(u string) error {
c.semaphore.Request()
defer c.semaphore.Release()
if c.timeout == 0 {
_, _, err := fasthttp.Get(nil, u)
return err
}
_, _, err := fasthttp.GetTimeout(nil, u, c.timeout)
return err
}

Loading…
Cancel
Save