Skip to content

Commit 2d34cf1

Browse files
committed
use TryProduce instead of blocking Produce if buffer is full
1 parent 2bc1ad7 commit 2d34cf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

e2e/producer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (s *Service) produceMessage(ctx context.Context, partition int) {
3434
pID := strconv.Itoa(partition)
3535
s.messagesProducedInFlight.WithLabelValues(pID).Inc()
3636
s.messageTracker.addToTracker(msg)
37-
s.client.Produce(childCtx, record, func(r *kgo.Record, err error) {
37+
s.client.TryProduce(childCtx, record, func(r *kgo.Record, err error) {
3838
defer cancel()
3939
ackDuration := time.Since(startTime)
4040
s.messagesProducedInFlight.WithLabelValues(pID).Dec()
@@ -45,7 +45,7 @@ func (s *Service) produceMessage(ctx context.Context, partition int) {
4545

4646
if err != nil {
4747
s.messagesProducedFailed.WithLabelValues(pID).Inc()
48-
s.messageTracker.removeFromTracker(msg.MessageID)
48+
_ = s.messageTracker.removeFromTracker(msg.MessageID)
4949

5050
s.logger.Info("failed to produce message to end-to-end topic",
5151
zap.String("topic_name", r.Topic),

0 commit comments

Comments
 (0)