Skip to content

Commit 1b2a8ba

Browse files
committed
PBM-397: return ctx.Err() from ListenCmd()
1 parent 5540251 commit 1b2a8ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pbm/ctrl/recv.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ func ListenCmd(ctx context.Context, m connect.Client, cl <-chan struct{}) (<-cha
4444
var lastCmd Command
4545
for {
4646
select {
47+
case <-ctx.Done():
48+
errc <- ctx.Err()
49+
return
4750
case <-cl:
4851
return
4952
default:
@@ -54,9 +57,6 @@ func ListenCmd(ctx context.Context, m connect.Client, cl <-chan struct{}) (<-cha
5457
)
5558
if err != nil {
5659
errc <- errors.Wrap(err, "watch the cmd stream")
57-
if errors.Is(err, context.Canceled) {
58-
return
59-
}
6060
continue
6161
}
6262

0 commit comments

Comments
 (0)