diff --git a/pkg/xtermjs/handler_websocket.go b/pkg/xtermjs/handler_websocket.go index b456b2c..28b7275 100644 --- a/pkg/xtermjs/handler_websocket.go +++ b/pkg/xtermjs/handler_websocket.go @@ -102,7 +102,9 @@ func GetHandler(opts HandlerOpts) func(http.ResponseWriter, *http.Request) { go func() { errorCounter := 0 for { - // consider the connection closed/errored out + // consider the connection closed/errored out so that the socket handler + // can be terminated - this frees up memory so the service doesn't get + // overloaded if errorCounter > connectionErrorLimit { waiter.Done() break @@ -135,7 +137,6 @@ func GetHandler(opts HandlerOpts) func(http.ResponseWriter, *http.Request) { if err != nil { if !connectionClosed { clog.Warnf("failed to get next reader: %s", err) - continue } return }