mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-29 12:16:16 +08:00
Use time.Since() for readability
This commit is contained in:
parent
a661007a55
commit
617012c3fb
|
@ -100,7 +100,7 @@ func (p Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
keepRetrying := func() bool {
|
keepRetrying := func() bool {
|
||||||
// if we've tried long enough, break
|
// if we've tried long enough, break
|
||||||
if time.Now().Sub(start) >= upstream.GetTryDuration() {
|
if time.Since(start) >= upstream.GetTryDuration() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// otherwise, wait and try the next available host
|
// otherwise, wait and try the next available host
|
||||||
|
|
Loading…
Reference in New Issue
Block a user