Skip to content

Commit cc42018

Browse files
fix: some issues
1 parent 487ee95 commit cc42018

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

agent/agentcontainers/api.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,7 @@ func (api *API) Routes() http.Handler {
549549
}
550550

551551
func (api *API) watchContainers(rw http.ResponseWriter, r *http.Request) {
552-
var (
553-
ctx = r.Context()
554-
)
552+
ctx := r.Context()
555553

556554
conn, err := websocket.Accept(rw, r, nil)
557555
if err != nil {
@@ -592,12 +590,13 @@ func (api *API) watchContainers(rw http.ResponseWriter, r *http.Request) {
592590
ct, err := api.getContainers()
593591
if err != nil {
594592
api.logger.Error(ctx, "get containers", slog.Error(err))
595-
} else {
596-
if err := encoder.Encode(ct); err != nil {
597-
api.logger.Error(ctx, "encode container list", slog.Error(err))
598-
}
593+
continue
599594
}
600595

596+
if err := encoder.Encode(ct); err != nil {
597+
api.logger.Error(ctx, "encode container list", slog.Error(err))
598+
return
599+
}
601600
}
602601
}
603602
}

0 commit comments

Comments
 (0)