Skip to content

Commit d5c4348

Browse files
authored
KafkaProducer: Flush pending records before close() (#2537)
1 parent ccd44ce commit d5c4348

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kafka/producer/kafka.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ def __getattr__(self, name):
506506
assert timeout >= 0
507507

508508
log.info("Closing the Kafka producer with %s secs timeout.", timeout)
509+
self.flush(timeout)
509510
invoked_from_callback = bool(threading.current_thread() is self._sender)
510511
if timeout > 0:
511512
if invoked_from_callback:

0 commit comments

Comments
 (0)