call cancel() even if the queue subscription fails
@@ -48,6 +48,7 @@ func (p *pubSubSubscriber) Run(signals <-chan os.Signal, ready chan<- struct{})
errs := make(chan error)
cctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
p.subscription.ReceiveSettings.MaxOutstandingMessages = 4
@@ -71,8 +72,6 @@ func (p *pubSubSubscriber) Run(signals <-chan os.Signal, ready chan<- struct{})
}
}
- cancel()
-
p.logger.Info("done")
return nil
