Skip to content

Commit ede14c8

Browse files
committed
fix writeRate
1 parent 8a5d73b commit ede14c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/topicctl/subcmd/tester.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,23 @@ func runTestWriter(ctx context.Context) error {
158158
return errors.New("Stopping because of user response")
159159
}
160160

161+
batchSize := 5
162+
161163
writer := kafka.NewWriter(
162164
kafka.WriterConfig{
163165
Brokers: []string{connector.Config.BrokerAddr},
164166
Dialer: connector.Dialer,
165167
Topic: testerConfig.topic,
166168
Balancer: &kafka.LeastBytes{},
167169
Async: false,
168-
BatchSize: 5,
170+
BatchSize: batchSize,
169171
BatchTimeout: 1 * time.Millisecond,
170172
},
171173
)
172174
defer writer.Close()
173175

174176
index := 0
175-
tickDuration := time.Duration(1000.0/float64(testerConfig.writeRate)) * time.Millisecond
177+
tickDuration := time.Duration(1000.0/float64(testerConfig.writeRate/batchSize)) * time.Millisecond
176178
sendTicker := time.NewTicker(tickDuration)
177179
logTicker := time.NewTicker(5 * time.Second)
178180

0 commit comments

Comments
 (0)