Skip to content

Commit 4142fb3

Browse files
committed
chore: shutdown provisioner should stop waiting on client
1 parent 845407f commit 4142fb3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

enterprise/cli/provisionerdaemons.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ func (r *RootCmd) provisionerDaemonStart() *serpent.Command {
239239
return xerrors.Errorf("shutdown: %w", err)
240240
}
241241

242+
// Shutdown does not call close. Must call it manually.
243+
err = srv.Close()
244+
if err != nil {
245+
return xerrors.Errorf("close server: %w", err)
246+
}
247+
242248
cancel()
243249
if xerrors.Is(exitErr, context.Canceled) {
244250
return nil

provisionerd/provisionerd.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ func (p *Server) client() (proto.DRPCProvisionerDaemonClient, bool) {
236236
select {
237237
case <-p.closeContext.Done():
238238
return nil, false
239+
case <-p.shuttingDownCh:
240+
// Shutting down should return a nil client and unblock
241+
return nil, false
239242
case client := <-p.clientCh:
240243
return client, true
241244
}

0 commit comments

Comments
 (0)