Merge pull request #833 from cpuguy83/fix_stream_idle_timeout_break

Fix stream timeout defaults
This commit is contained in:
Brian Goff
2020-06-03 20:32:53 -07:00
committed by GitHub

View File

@@ -91,6 +91,14 @@ func HandleContainerExec(h ContainerExecHandlerFunc, opts ...ContainerExecHandle
for _, o := range opts { for _, o := range opts {
o(&cfg) 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 { return handleError(func(w http.ResponseWriter, req *http.Request) error {
vars := mux.Vars(req) vars := mux.Vars(req)
@@ -108,6 +116,7 @@ func HandleContainerExec(h ContainerExecHandlerFunc, opts ...ContainerExecHandle
return errdefs.AsInvalidInput(err) return errdefs.AsInvalidInput(err)
} }
// TODO: Why aren't we using req.Context() here?
ctx, cancel := context.WithCancel(context.TODO()) ctx, cancel := context.WithCancel(context.TODO())
defer cancel() defer cancel()