Skip to content

Commit

Permalink
bugfix duplicate channel creation on every message visit (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
frairon authored Jun 28, 2022
1 parent 40cf0d4 commit f078934
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions partition_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,13 @@ func (pp *PartitionProcessor) VisitValues(ctx context.Context, name string, meta
}

defer it.Release()
stopping := pp.stopping()
for it.Next() {
// add one that we were able to be put into the queue.
// wg.Done will be called by the visit handler as commit
wg.Add(1)
select {
case <-pp.stopping():
case <-stopping:
drainVisitInput()
wg.Done()
return ErrVisitAborted
Expand Down Expand Up @@ -741,7 +742,7 @@ func (pp *PartitionProcessor) VisitValues(ctx context.Context, name string, meta
wg.Wait()
}()
select {
case <-pp.stopping():
case <-stopping:
drainVisitInput()
return ErrVisitAborted
case <-ctx.Done():
Expand Down

0 comments on commit f078934

Please sign in to comment.