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

Commit205eb29

Browse files
fix: stop reading closed channel for/watch devcontainers endpoint (#19373)
Fixes#19372We increase the read limit to 4MiB (we use this limit elsewhere). Wealso make sure to stop sending messages when `containersCh` becomesclosed.
1 parenta9f607a commit205eb29

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
@@ -896,7 +896,11 @@ func (api *API) watchWorkspaceAgentContainers(rw http.ResponseWriter, r *http.Re
896896
case<-ctx.Done():
897897
return
898898

899-
casecontainers:=<-containersCh:
899+
casecontainers,ok:=<-containersCh:
900+
if!ok {
901+
return
902+
}
903+
900904
iferr:=encoder.Encode(containers);err!=nil {
901905
api.Logger.Error(ctx,"encode containers",slog.Error(err))
902906
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp