Live: fix closing ws conns for push endpoints (#42447) (#42464)

(cherry picked from commit 7034173ef5)

Co-authored-by: Alexander Emelin <frvzmb@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-11-29 17:45:49 +01:00
committed by GitHub
co-authored by Alexander Emelin
parent 83416f911c
commit dead7e1a1f
2 changed files with 4 additions and 0 deletions
@@ -55,11 +55,13 @@ func (s *PipelinePushHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if err != nil {
return
}
defer func() { _ = conn.Close() }()
setupWSConn(r.Context(), conn, s.config)
for {
_, body, err := conn.ReadMessage()
if err != nil {
logger.Debug("Error reading websocket connection", "error", err)
break
}
+2
View File
@@ -57,11 +57,13 @@ func (s *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
if err != nil {
return
}
defer func() { _ = conn.Close() }()
setupWSConn(r.Context(), conn, s.config)
for {
_, body, err := conn.ReadMessage()
if err != nil {
logger.Debug("Error reading websocket connection", "error", err)
break
}