Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3db876

Browse files
fix: stop reading closed channel for/watch devcontainers endpoint (#19373) (#20095)
Fixes#19372
1 parenta9bdbdb commitf3db876

File tree

5 files changed

+251
-151
lines changed

5 files changed

+251
-151
lines changed

‎agent/agentcontainers/api.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,11 @@ func (api *API) broadcastUpdatesLocked() {
763763
func (api*API)watchContainers(rw http.ResponseWriter,r*http.Request) {
764764
ctx:=r.Context()
765765

766-
conn,err:=websocket.Accept(rw,r,nil)
766+
conn,err:=websocket.Accept(rw,r,&websocket.AcceptOptions{
767+
// We want `NoContextTakeover` compression to balance improving
768+
// bandwidth cost/latency with minimal memory usage overhead.
769+
CompressionMode:websocket.CompressionNoContextTakeover,
770+
})
767771
iferr!=nil {
768772
httpapi.Write(ctx,rw,http.StatusInternalServerError, codersdk.Response{
769773
Message:"Failed to upgrade connection to websocket.",

‎coderd/workspaceagents.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,11 @@ func (api *API) watchWorkspaceAgentContainers(rw http.ResponseWriter, r *http.Re
899899
case<-ctx.Done():
900900
return
901901

902-
casecontainers:=<-containersCh:
902+
casecontainers,ok:=<-containersCh:
903+
if!ok {
904+
return
905+
}
906+
903907
iferr:=encoder.Encode(containers);err!=nil {
904908
api.Logger.Error(ctx,"encode containers",slog.Error(err))
905909
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp