From 51b9a6c40d0240e37d561466a2ae01ec4255d174 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Wed, 3 Jun 2020 10:01:34 -0700 Subject: [PATCH] Fix stream timeout defaults This was an unintentional breaking change in 0bdf7423037e0ccefb794c8b5f570137c65ce864 A timeout of 0 doesn't make any sense, so use the old values of 30s as a default. --- node/api/exec.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node/api/exec.go b/node/api/exec.go index f122a76cb..938a1fcf3 100644 --- a/node/api/exec.go +++ b/node/api/exec.go @@ -91,6 +91,14 @@ func HandleContainerExec(h ContainerExecHandlerFunc, opts ...ContainerExecHandle for _, o := range opts { o(&cfg) } + + if cfg.StreamIdleTimeout == 0 { + cfg.StreamIdleTimeout = 30 * time.Second + } + if cfg.StreamCreationTimeout == 0 { + cfg.StreamCreationTimeout = 30 * time.Second + } + return handleError(func(w http.ResponseWriter, req *http.Request) error { vars := mux.Vars(req) @@ -108,6 +116,7 @@ func HandleContainerExec(h ContainerExecHandlerFunc, opts ...ContainerExecHandle return errdefs.AsInvalidInput(err) } + // TODO: Why aren't we using req.Context() here? ctx, cancel := context.WithCancel(context.TODO()) defer cancel()