Skip to content

Commit

Permalink
Flush before close: If there are any messages pending, flush them bef…
Browse files Browse the repository at this point in the history
…ore doing anything else
  • Loading branch information
Moshe Zadka committed Mar 17, 2021
1 parent f19e423 commit 5266f55
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kafka/producer/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ def close(self, timeout=None):
timeout (float, optional): timeout in seconds to wait for completion.
"""

# If there are any pending messages, send them now
self.flush(timeout)
# drop our atexit handler now to avoid leaks
self._unregister_cleanup()

Expand Down

0 comments on commit 5266f55

Please sign in to comment.