Skip to content

Commit

Permalink
Add timeout for producing records
Browse files Browse the repository at this point in the history
  • Loading branch information
weeco committed Aug 11, 2021
1 parent d0348bd commit 4285a76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion e2e/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func (s *Service) produceMessage(ctx context.Context, partition int) {
// This childCtx will ensure that we will abort our efforts to produce (including retries) when we exceed
// the SLA for producers.
childCtx, cancel := context.WithTimeout(ctx, s.config.Producer.AckSla)
defer cancel()

s.endToEndMessagesProducedInFlight.Inc()
s.client.Produce(childCtx, record, func(r *kgo.Record, err error) {
defer cancel()
ackDuration := time.Since(startTime)
s.endToEndMessagesProducedInFlight.Dec()
s.endToEndMessagesProducedTotal.Inc()
Expand Down

0 comments on commit 4285a76

Please sign in to comment.