Skip to content

Commit

Permalink
PBM-397: return ctx.Err() from ListenCmd()
Browse files Browse the repository at this point in the history
  • Loading branch information
defbin committed Sep 30, 2024
1 parent 20103f1 commit a0fa275
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pbm/ctrl/recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func ListenCmd(ctx context.Context, m connect.Client, cl <-chan struct{}) (<-cha
var lastCmd Command
for {
select {
case <-ctx.Done():
errc <- ctx.Err()
return
case <-cl:
return
default:
Expand All @@ -54,9 +57,6 @@ func ListenCmd(ctx context.Context, m connect.Client, cl <-chan struct{}) (<-cha
)
if err != nil {
errc <- errors.Wrap(err, "watch the cmd stream")
if errors.Is(err, context.Canceled) {
return
}
continue
}

Expand Down

0 comments on commit a0fa275

Please sign in to comment.