mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-07-19 03:11:41 +02:00
Handle shutdown sequentially
This commit is contained in:
@@ -68,10 +68,11 @@ func (sm *sinkManager) Start() {
|
||||
go func() {
|
||||
done := func() {
|
||||
for _, s := range sm.outputs {
|
||||
s.Flush()
|
||||
s.Close()
|
||||
}
|
||||
cclog.ComponentDebug("SinkManager", "DONE")
|
||||
sm.wg.Done()
|
||||
cclog.ComponentDebug("SinkManager", "DONE")
|
||||
}
|
||||
for {
|
||||
select {
|
||||
@@ -128,11 +129,8 @@ func (sm *sinkManager) AddOutput(rawConfig json.RawMessage) error {
|
||||
}
|
||||
|
||||
func (sm *sinkManager) Close() {
|
||||
select {
|
||||
case sm.done <- true:
|
||||
default:
|
||||
}
|
||||
cclog.ComponentDebug("SinkManager", "CLOSE")
|
||||
sm.done <- true
|
||||
}
|
||||
|
||||
func New(wg *sync.WaitGroup, sinkConfigFile string) (SinkManager, error) {
|
||||
|
Reference in New Issue
Block a user