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

Commit

Permalink
add channel pool
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Jul 27, 2017
1 parent d3fd4b8 commit 0e6fe54
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions monitor/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (client *KafkaClient) Start() {
go func() {
defer client.wgProcessor.Done()
for msg := range client.messageChannel {
go client.RefreshConsumerOffset(msg)
client.RefreshConsumerOffset(msg)
}
}()
go func() {
Expand Down Expand Up @@ -154,8 +154,14 @@ func (client *KafkaClient) Start() {
client.wgFanIn.Add(2)
go func() {
defer client.wgFanIn.Done()
//20 pool per partition
var pool = make(chan struct{}, 20)
for msg := range pconsumer.Messages() {
client.messageChannel <- msg
pool <- struct{}{}
go func() {
client.messageChannel <- msg
<-pool
}()
}
}()
go func() {
Expand Down

0 comments on commit 0e6fe54

Please sign in to comment.