0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Use time.Since() for readability

This commit is contained in:
Matthew Holt 2016-09-24 21:27:57 -06:00
parent a661007a55
commit 617012c3fb
No known key found for this signature in database
GPG key ID: 0D97CC73664F4D03

View file

@ -100,7 +100,7 @@ func (p Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
start := time.Now()
keepRetrying := func() bool {
// if we've tried long enough, break
if time.Now().Sub(start) >= upstream.GetTryDuration() {
if time.Since(start) >= upstream.GetTryDuration() {
return false
}
// otherwise, wait and try the next available host