Skip to content

Commit

Permalink
fix: prevent ConsumerGroup.Close infinitely locking (#2717)
Browse files Browse the repository at this point in the history
Signed-off-by: Magomed Abdurakhmanov <maqdev@gmail.com>
  • Loading branch information
maqdev authored Jan 31, 2024
1 parent e412d44 commit 5c3ffea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ func (c *consumerGroup) Consume(ctx context.Context, topics []string, handler Co
return err
}

// Wait for session exit signal
<-sess.ctx.Done()
// Wait for session exit signal or Close() call
select {
case <-c.closed:
case <-sess.ctx.Done():
}

// Gracefully release session claims
return sess.release(true)
Expand Down

0 comments on commit 5c3ffea

Please sign in to comment.