File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -549,9 +549,7 @@ func (api *API) Routes() http.Handler {
549
549
}
550
550
551
551
func (api * API ) watchContainers (rw http.ResponseWriter , r * http.Request ) {
552
- var (
553
- ctx = r .Context ()
554
- )
552
+ ctx := r .Context ()
555
553
556
554
conn , err := websocket .Accept (rw , r , nil )
557
555
if err != nil {
@@ -592,12 +590,13 @@ func (api *API) watchContainers(rw http.ResponseWriter, r *http.Request) {
592
590
ct , err := api .getContainers ()
593
591
if err != nil {
594
592
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
599
594
}
600
595
596
+ if err := encoder .Encode (ct ); err != nil {
597
+ api .logger .Error (ctx , "encode container list" , slog .Error (err ))
598
+ return
599
+ }
601
600
}
602
601
}
603
602
}
You can’t perform that action at this time.
0 commit comments