fix(inputs.influxdb_v2_listener): Fix concurrent read/write dict (#15982)
This commit is contained in:
parent
ba413e36f8
commit
a9a214e19a
|
|
@ -166,12 +166,12 @@ func (h *InfluxDBV2Listener) Start(acc telegraf.Accumulator) error {
|
||||||
case <-h.ctx.Done():
|
case <-h.ctx.Done():
|
||||||
return
|
return
|
||||||
case info := <-h.trackingAcc.Delivered():
|
case info := <-h.trackingAcc.Delivered():
|
||||||
|
h.countLock.Lock()
|
||||||
if count, ok := h.trackingMetricCount[info.ID()]; ok {
|
if count, ok := h.trackingMetricCount[info.ID()]; ok {
|
||||||
h.countLock.Lock()
|
|
||||||
h.totalUndeliveredMetrics.Add(-count)
|
h.totalUndeliveredMetrics.Add(-count)
|
||||||
delete(h.trackingMetricCount, info.ID())
|
delete(h.trackingMetricCount, info.ID())
|
||||||
h.countLock.Unlock()
|
|
||||||
}
|
}
|
||||||
|
h.countLock.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue