Remove metrics from the buffer on write (#5052)

This commit is contained in:
Daniel Nelson 2018-11-29 12:58:48 -08:00 committed by GitHub
parent 9b3452a65d
commit 0a506a93fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -175,9 +175,10 @@ func (b *Buffer) Accept(batch []telegraf.Metric) {
b.metricWritten(m)
}
if b.batchSize > 0 {
b.size -= b.batchSize
b.first += b.batchSize
b.size -= b.batchSize
for i := 0; i < b.batchSize; i++ {
b.buf[b.first] = nil
b.first++
b.first %= b.cap
}