Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion agent/agentcontainers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,11 @@ func (api *API) broadcastUpdatesLocked() {
func (api *API) watchContainers(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()

conn, err := websocket.Accept(rw, r, nil)
conn, err := websocket.Accept(rw, r, &websocket.AcceptOptions{
// We want `NoContextTakeover` compression to balance improving
// bandwidth cost/latency with minimal memory usage overhead.
CompressionMode: websocket.CompressionNoContextTakeover,
})
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Failed to upgrade connection to websocket.",
Expand Down
6 changes: 5 additions & 1 deletion coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,11 @@ func (api *API) watchWorkspaceAgentContainers(rw http.ResponseWriter, r *http.Re
case <-ctx.Done():
return

case containers := <-containersCh:
case containers, ok := <-containersCh:
if !ok {
return
}

if err := encoder.Encode(containers); err != nil {
api.Logger.Error(ctx, "encode containers", slog.Error(err))
return
Expand Down
Loading
Loading