Skip to content

Commit

Permalink
Buffer authhandler output channel to prevent hang on shutdown (#5507)
Browse files Browse the repository at this point in the history
Fixes #5026
  • Loading branch information
jefferai authored Oct 15, 2018
1 parent 574a08c commit d7655a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions command/agent/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ type AuthHandlerConfig struct {

func NewAuthHandler(conf *AuthHandlerConfig) *AuthHandler {
ah := &AuthHandler{
DoneCh: make(chan struct{}),
OutputCh: make(chan string),
DoneCh: make(chan struct{}),
// This is buffered so that if we try to output after the sink server
// has been shut down, during agent shutdown, we won't block
OutputCh: make(chan string, 1),
logger: conf.Logger,
client: conf.Client,
random: rand.New(rand.NewSource(int64(time.Now().Nanosecond()))),
Expand Down

0 comments on commit d7655a9

Please sign in to comment.