Skip to content

Commit

Permalink
fix: race condition for wg (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Sep 8, 2022
1 parent c8baa4b commit d58f993
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pump.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ func NewAsyncPump(mon Monitor, node Node, pipe TimedPipe, errFn ErrorFunc) Pump
ch: make(chan Message, 1000),
}

p.wg.Add(1)
go p.run()

return p
}

func (p *asyncPump) run() {
p.wg.Add(1)
defer p.wg.Done()

for msg := range p.ch {
Expand Down Expand Up @@ -194,13 +194,13 @@ func NewSourcePump(mon Monitor, name string, source Source, pumps []Pump, errFn
quit: make(chan struct{}, 2),
}

p.wg.Add(1)
go p.run()

return p
}

func (p *sourcePump) run() {
p.wg.Add(1)
defer p.wg.Done()

for {
Expand Down

0 comments on commit d58f993

Please sign in to comment.