15003: Add dispatch-cloud configs to default/template file.
[arvados.git] / lib / controller / handler.go
index 295dde7ca42821b1c8f904eec42ac7e7764812fa..35734d780c9bf1819c9f7b0875d0903858f95125 100644 (file)
@@ -50,8 +50,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
                        req.URL.Path = strings.Replace(req.URL.Path, "//", "/", -1)
                }
        }
-       if h.Cluster.HTTPRequestTimeout > 0 {
-               ctx, cancel := context.WithDeadline(req.Context(), time.Now().Add(time.Duration(h.Cluster.HTTPRequestTimeout)))
+       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()
        }
@@ -72,6 +72,7 @@ func (h *Handler) setup() {
        mux.Handle("/_health/", &health.Handler{
                Token:  h.Cluster.ManagementToken,
                Prefix: "/_health/",
+               Routes: health.Routes{"ping": func() error { _, err := h.db(&http.Request{}); return err }},
        })
        hs := http.NotFoundHandler()
        hs = prepend(hs, h.proxyRailsAPI)
@@ -80,12 +81,10 @@ func (h *Handler) setup() {
        h.handlerStack = mux
 
        sc := *arvados.DefaultSecureClient
-       sc.Timeout = time.Duration(h.Cluster.HTTPRequestTimeout)
        sc.CheckRedirect = neverRedirect
        h.secureClient = &sc
 
        ic := *arvados.InsecureHTTPClient
-       ic.Timeout = time.Duration(h.Cluster.HTTPRequestTimeout)
        ic.CheckRedirect = neverRedirect
        h.insecureClient = &ic