wg.Add len of decorators
Vladimir Bauer
1 year, 10 months ago
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | func (s bState) decoratorEwmaUpdate(n int64, dur time.Duration, wg *sync.WaitGroup) { |
| 583 | wg.Add(len(s.ewmaDecorators)) | |
| 583 | 584 | for _, d := range s.ewmaDecorators { |
| 584 | wg.Add(1) | |
| 585 | 585 | d := d |
| 586 | 586 | go func() { |
| 587 | 587 | d.EwmaUpdate(n, dur) |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | func (s bState) decoratorAverageAdjust(start time.Time, wg *sync.WaitGroup) { |
| 594 | wg.Add(len(s.averageDecorators)) | |
| 594 | 595 | for _, d := range s.averageDecorators { |
| 595 | wg.Add(1) | |
| 596 | 596 | d := d |
| 597 | 597 | go func() { |
| 598 | 598 | d.AverageAdjust(start) |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | func (s bState) decoratorShutdownNotify(wg *sync.WaitGroup) { |
| 605 | wg.Add(len(s.shutdownListeners)) | |
| 605 | 606 | for _, d := range s.shutdownListeners { |
| 606 | wg.Add(1) | |
| 607 | 607 | d := d |
| 608 | 608 | go func() { |
| 609 | 609 | d.OnShutdown() |