Move all flush operations to the sinks

This commit is contained in:
Holger Obermaier
2022-02-09 19:47:49 +01:00
parent 1d299be3ea
commit a0e97d216a
2 changed files with 21 additions and 14 deletions

View File

@@ -82,8 +82,6 @@ func (sm *sinkManager) Init(wg *sync.WaitGroup, sinkConfigFile string) error {
// Start starts the sink managers background task, which
// distributes received metrics to the sinks
func (sm *sinkManager) Start() {
batchcount := 20
sm.wg.Add(1)
go func() {
defer sm.wg.Done()
@@ -91,7 +89,6 @@ func (sm *sinkManager) Start() {
// Sink manager is done
done := func() {
for _, s := range sm.sinks {
s.Flush()
s.Close()
}
@@ -111,16 +108,6 @@ func (sm *sinkManager) Start() {
for _, s := range sm.sinks {
s.Write(p)
}
// Flush all outputs
if batchcount == 0 {
cclog.ComponentDebug("SinkManager", "FLUSH")
for _, s := range sm.sinks {
s.Flush()
}
batchcount = 20
}
batchcount--
}
}
}()