[arvados] updated: 2.1.0-2617-g6d9479cea

git repository hosting git at public.arvados.org
Fri Jun 24 13:40:26 UTC 2022


Summary of changes:
 lib/controller/handler.go   | 7 -------
 sdk/go/httpserver/logger.go | 6 ++++++
 2 files changed, 6 insertions(+), 7 deletions(-)

       via  6d9479cea3135d6bc62880832474cc72af052712 (commit)
      from  66ac14621e8a624c704618f604e7998656d63042 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 6d9479cea3135d6bc62880832474cc72af052712
Author: Tom Clegg <tom at curii.com>
Date:   Fri Jun 24 09:38:46 2022 -0400

    19205: Remove redundant RequestTimeout implementation.
    
    lib/controller doesn't need its own -- it uses lib/service, which uses
    httpserver.HandlerWithDeadline.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/controller/handler.go b/lib/controller/handler.go
index f5840b34c..665fd5c63 100644
--- a/lib/controller/handler.go
+++ b/lib/controller/handler.go
@@ -13,7 +13,6 @@ import (
 	"net/url"
 	"strings"
 	"sync"
-	"time"
 
 	"git.arvados.org/arvados.git/lib/controller/api"
 	"git.arvados.org/arvados.git/lib/controller/federation"
@@ -61,12 +60,6 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
 			req.URL.Path = strings.Replace(req.URL.Path, "//", "/", -1)
 		}
 	}
-	if h.Cluster.API.RequestTimeout > 0 {
-		ctx, cancel := context.WithDeadline(req.Context(), time.Now().Add(time.Duration(h.Cluster.API.RequestTimeout)))
-		req = req.WithContext(ctx)
-		defer cancel()
-	}
-
 	h.handlerStack.ServeHTTP(w, req)
 }
 
diff --git a/sdk/go/httpserver/logger.go b/sdk/go/httpserver/logger.go
index 5a46635e9..b71adf711 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()

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list