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