Skip to content

Commit b8da199

Browse files
Ormoddpkp
authored andcommitted
producer: Set exit timeout to 0 for atexit handler to match __del__ (#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 b1cc966 commit b8da199

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
@@ -371,7 +371,7 @@ def _cleanup_factory(self):
371371
_self = weakref.proxy(self)
372372
def wrapper():
373373
try:
374-
_self.close()
374+
_self.close(timeout=0)
375375
except (ReferenceError, AttributeError):
376376
pass
377377
return wrapper

0 commit comments

Comments
 (0)