Skip to content

Commit

Permalink
fix throughput error
Browse files Browse the repository at this point in the history
  • Loading branch information
KerryJava committed Jun 20, 2021
1 parent 77748c5 commit 7d51633
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 7d51633

Please sign in to comment.