As there is self._closed = False in __init__, then it requires to call await producer.stop() even if it is not started.
producer = aiokafka.AIOKafkaProducer(bootstrap_servers="localhost:9092")
del producer # Unclosed AIOKafkaProducer
|
self._closed = False |
|
|
|
# Warn if producer was not closed properly |
|
# We don't attempt to close the Consumer, as __del__ is synchronous |
|
def __del__(self, _warnings=warnings): |
|
if self._closed is False: |
|
_warnings.warn(f"Unclosed AIOKafkaProducer {self!r}", |
|
ResourceWarning, |
|
source=self) |
As there is
self._closed = Falsein__init__, then it requires to callawait producer.stop()even if it is not started.aiokafka/aiokafka/producer/producer.py
Lines 286 to 294 in 00349a8