chore: shutdown provisioner should stop waiting on client

This commit is contained in:
Steven Masley 2024-05-01 13:00:12 -05:00
parent 845407fe7a
commit 4142fb3576
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View File

@ -239,6 +239,12 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
return xerrors.Errorf("shutdown: %w", err)
}
// Shutdown does not call close. Must call it manually.
err = srv.Close()
if err != nil {
return xerrors.Errorf("close server: %w", err)
}
cancel()
if xerrors.Is(exitErr, context.Canceled) {
return nil

View File

@ -236,6 +236,9 @@ func (p *Server) client() (proto.DRPCProvisionerDaemonClient, bool) {
select {
case <-p.closeContext.Done():
return nil, false
case <-p.shuttingDownCh:
// Shutting down should return a nil client and unblock
return nil, false
case client := <-p.clientCh:
return client, true
}