Skip to content

Commit c962ec0

Browse files
Ormod88manpreet
authored andcommitted
producer: Set exit timeout to 0 for atexit handler to match __del__ (dpkp#1126)
Hit a problem with pytest hitting the atexit handler and waiting for close() timeout forever at teardown. This commit makes atexit close() equivalent to __del__ behavior, namely using timeout of 0 for close() completion. If you need a longer timeout you should be setting it explicitly.
1 parent 6dfcf71 commit c962ec0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kafka/producer/kafka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def _cleanup_factory(self):
370370
_self = weakref.proxy(self)
371371
def wrapper():
372372
try:
373-
_self.close()
373+
_self.close(timeout=0)
374374
except (ReferenceError, AttributeError):
375375
pass
376376
return wrapper

0 commit comments

Comments
 (0)