Skip to content

Commit d8ed1db

Browse files
committed
wg.Add len of decorators
1 parent a4b4b53 commit d8ed1db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bar.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@ func (s bState) completed() bool {
581581
}
582582

583583
func (s bState) decoratorEwmaUpdate(n int64, dur time.Duration, wg *sync.WaitGroup) {
584+
wg.Add(len(s.ewmaDecorators))
584585
for _, d := range s.ewmaDecorators {
585-
wg.Add(1)
586586
d := d
587587
go func() {
588588
d.EwmaUpdate(n, dur)
@@ -592,8 +592,8 @@ func (s bState) decoratorEwmaUpdate(n int64, dur time.Duration, wg *sync.WaitGro
592592
}
593593

594594
func (s bState) decoratorAverageAdjust(start time.Time, wg *sync.WaitGroup) {
595+
wg.Add(len(s.averageDecorators))
595596
for _, d := range s.averageDecorators {
596-
wg.Add(1)
597597
d := d
598598
go func() {
599599
d.AverageAdjust(start)
@@ -603,8 +603,8 @@ func (s bState) decoratorAverageAdjust(start time.Time, wg *sync.WaitGroup) {
603603
}
604604

605605
func (s bState) decoratorShutdownNotify(wg *sync.WaitGroup) {
606+
wg.Add(len(s.shutdownListeners))
606607
for _, d := range s.shutdownListeners {
607-
wg.Add(1)
608608
d := d
609609
go func() {
610610
d.OnShutdown()

0 commit comments

Comments
 (0)