Allow more then one background send operation

This commit is contained in:
Holger Obermaier 2023-10-13 15:15:10 +02:00
parent 78fac33a06
commit 4bee75d4b5

View File

@ -366,7 +366,6 @@ func (s *InfluxSink) Flush() error {
cclog.ComponentDebug(s.name, "Flush(): Flushing", numRecordsInBuf, "metrics") cclog.ComponentDebug(s.name, "Flush(): Flushing", numRecordsInBuf, "metrics")
// Asynchron send of encoder metrics // Asynchron send of encoder metrics
s.sendWaitGroup.Wait()
s.sendWaitGroup.Add(1) s.sendWaitGroup.Add(1)
go func() { go func() {
defer s.sendWaitGroup.Done() defer s.sendWaitGroup.Done()
@ -404,7 +403,7 @@ func (s *InfluxSink) Close() {
cclog.ComponentError(s.name, "Close():", "Flush failed:", err) cclog.ComponentError(s.name, "Close():", "Flush failed:", err)
} }
// Wait for send operation to finish // Wait for send operations to finish
s.sendWaitGroup.Wait() s.sendWaitGroup.Wait()
s.client.Close() s.client.Close()