Wait for close of done channel, to ensure manager finished.

This commit is contained in:
Holger Obermaier
2022-01-30 12:08:33 +01:00
parent 8df58c051f
commit 9e99e47d73
4 changed files with 15 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ func (t *multiChanTicker) Init(duration time.Duration) {
t.done = make(chan bool)
go func() {
done := func() {
close(t.done)
cclog.ComponentDebug("MultiChanTicker", "DONE")
}
for {
@@ -52,6 +53,8 @@ func (t *multiChanTicker) AddChannel(channel chan time.Time) {
func (t *multiChanTicker) Close() {
cclog.ComponentDebug("MultiChanTicker", "CLOSE")
t.done <- true
// wait for close of channel t.done
<-t.done
}
func NewTicker(duration time.Duration) MultiChanTicker {