diff --git a/pbm/ctrl/recv.go b/pbm/ctrl/recv.go index 37b5242d7..040b5f8e3 100644 --- a/pbm/ctrl/recv.go +++ b/pbm/ctrl/recv.go @@ -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: @@ -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 }