Skip to content

Commit

Permalink
Merge pull request #1971 from KerryJava/master
Browse files Browse the repository at this point in the history
fix  kafka-producer-performance throughput panic
  • Loading branch information
dnwe authored Jun 21, 2021
2 parents 77748c5 + 7d51633 commit 7d06a47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/kafka-producer-performance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ func runAsyncProducer(topic string, partition, messageLoad, messageSize int,

if throughput > 0 {
ticker := time.NewTicker(time.Second)
for _, message := range messages {
for i := 0; i < throughput; i++ {
producer.Input() <- message
for idx, message := range messages {
producer.Input() <- message
if (idx+1)%throughput == 0 {
<-ticker.C
}
<-ticker.C
}
ticker.Stop()
} else {
Expand Down

0 comments on commit 7d06a47

Please sign in to comment.