Skip to content

Commit 99bc503

Browse files
committed
Catch duplicate batch.done() calls -- this can happen if we maybe_expire then process a response errback
1 parent 642b640 commit 99bc503

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kafka/producer/record_accumulator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ def done(self, base_offset=None, exception=None):
6868
log.debug("Produced messages to topic-partition %s with base offset"
6969
" %s and error %s.", self.topic_partition, base_offset,
7070
exception) # trace
71-
if exception is None:
71+
if self.produce_future.is_done:
72+
log.warning('Batch is already closed -- ignoring batch.done()')
73+
return
74+
elif exception is None:
7275
self.produce_future.success(base_offset)
7376
else:
7477
self.produce_future.failure(exception)

0 commit comments

Comments
 (0)