commit fea9df75403b35753493585b073cd3eec1aa3c7d Author: Arlo Breault arlolra@gmail.com Date: Thu Oct 12 18:12:11 2017 -0400
Use context.WithTimeout instead of transport.Deadline
* The field was removed in, https://github.com/golang/appengine/commit/11ed51af43a1f8a9ce2afc951b10dbb7b... --- appengine/reflect.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/appengine/reflect.go b/appengine/reflect.go index c48bfe6..f5aa3c8 100644 --- a/appengine/reflect.go +++ b/appengine/reflect.go @@ -74,14 +74,13 @@ func handler(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } + if urlFetchTimeout != 0 { + context_, _ = context.WithTimeout(context_, urlFetchTimeout) + } // Use urlfetch.Transport directly instead of urlfetch.Client because we // want only a single HTTP transaction, not following redirects. transport := urlfetch.Transport{ Context: context_, - // Despite the name, Transport.Deadline is really a timeout and - // not an absolute deadline as used in the net package. In - // other words it is a time.Duration, not a time.Time. - Deadline: urlFetchTimeout, } resp, err := transport.RoundTrip(fr) if err != nil {