fix(inputs.influxdb_v2_listener): Fix concurrent read/write dict (#15982)

This commit is contained in:
Lars Stegman 2024-10-07 16:20:01 +02:00 committed by GitHub
parent ba413e36f8
commit a9a214e19a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -166,12 +166,12 @@ func (h *InfluxDBV2Listener) Start(acc telegraf.Accumulator) error {
case <-h.ctx.Done():
return
case info := <-h.trackingAcc.Delivered():
h.countLock.Lock()
if count, ok := h.trackingMetricCount[info.ID()]; ok {
h.countLock.Lock()
h.totalUndeliveredMetrics.Add(-count)
delete(h.trackingMetricCount, info.ID())
h.countLock.Unlock()
}
h.countLock.Unlock()
}
}
}()