Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Fix PartitionConsumer race condition on Close. (#258)
Browse files Browse the repository at this point in the history
* Use Sarama AsyncClose for Sarama Cluster AsyncClose

* Async Close PartitionConsumer in Consumer.Close()
  • Loading branch information
georgeteo authored and dim committed Aug 15, 2018
1 parent 7e67d87 commit 6230ffb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion consumer.go
Expand Up @@ -295,7 +295,7 @@ func (c *Consumer) Close() (err error) {
for range c.errors {
}
for p := range c.partitions {
_ = p.Close()
p.AsyncClose()
}
for range c.notifications {
}
Expand Down
2 changes: 1 addition & 1 deletion partitions.go
Expand Up @@ -86,7 +86,7 @@ func (c *partitionConsumer) InitialOffset() int64 { return c.initialOffset }
// AsyncClose implements PartitionConsumer
func (c *partitionConsumer) AsyncClose() {
c.closeOnce.Do(func() {
c.closeErr = c.PartitionConsumer.Close()
c.PartitionConsumer.AsyncClose()
close(c.dying)
})
}
Expand Down

0 comments on commit 6230ffb

Please sign in to comment.