Skip to content

Commit 31ee4ed

Browse files
author
Dana Powers
committed
Log deprecation warning for timeout argument in Producer.stop()
1 parent 3b42254 commit 31ee4ed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

kafka/producer/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,16 +415,20 @@ def _send_messages(self, topic, partition, *msg, **kwargs):
415415
raise
416416
return resp
417417

418-
def stop(self):
418+
def stop(self, timeout=None):
419419
"""
420420
Stop the producer (async mode). Blocks until async thread completes.
421421
"""
422+
if timeout is not None:
423+
log.warning('timeout argument to stop() is deprecated - '
424+
'it will be removed in future release')
425+
422426
if not self.async:
423-
log.warning("producer.stop() called, but producer is not async")
427+
log.warning('producer.stop() called, but producer is not async')
424428
return
425429

426430
if self.stopped:
427-
log.warning("producer.stop() called, but producer is already stopped")
431+
log.warning('producer.stop() called, but producer is already stopped')
428432
return
429433

430434
if self.async:

0 commit comments

Comments
 (0)