Skip to content

Commit c10367e

Browse files
committed
KafkaProducer: Flush pending records before close()
1 parent a1b3299 commit c10367e

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)