X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f41534fcdfa95c282a04d64158f8a7d850637768..276f020c46d375e9884d385340cfb4c3a5486639:/sdk/go/httpserver/logger.go diff --git a/sdk/go/httpserver/logger.go b/sdk/go/httpserver/logger.go index 5a46635e91..b71adf7118 100644 --- a/sdk/go/httpserver/logger.go +++ b/sdk/go/httpserver/logger.go @@ -47,7 +47,13 @@ func (hn hijackNotifier) Hijack() (net.Conn, *bufio.ReadWriter, error) { // HandlerWithDeadline cancels the request context if the request // takes longer than the specified timeout without having its // connection hijacked. +// +// If timeout is 0, there is no deadline: HandlerWithDeadline is a +// no-op. func HandlerWithDeadline(timeout time.Duration, next http.Handler) http.Handler { + if timeout == 0 { + return next + } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx, cancel := context.WithCancel(r.Context()) defer cancel()