Fix test race in kafka_consumer (#7797)

This commit is contained in:
Daniel Nelson 2020-07-07 14:04:55 -07:00 committed by GitHub
parent 63ba7096f7
commit bf9c9bfe4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -212,9 +212,11 @@ func (a *Accumulator) AddTrackingMetricGroup(group []telegraf.Metric) telegraf.T
}
func (a *Accumulator) Delivered() <-chan telegraf.DeliveryInfo {
a.Lock()
if a.delivered == nil {
a.delivered = make(chan telegraf.DeliveryInfo)
}
a.Unlock()
return a.delivered
}