Buffer authhandler output channel to prevent hang on shutdown (#5507)

Fixes #5026
This commit is contained in:
Jeff Mitchell 2018-10-15 11:02:53 -04:00 committed by GitHub
parent 574a08c064
commit d7655a9db0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()))),