aio-libs / aiokafka

asyncio client for kafka
http://aiokafka.readthedocs.io/
Apache License 2.0
1.13k stars 228 forks source link

Inconsistent producer start/stop #938

Open valq7711 opened 11 months ago

valq7711 commented 11 months ago

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

https://github.com/aio-libs/aiokafka/blob/00349a841b5b411ada7a3596817439b9d583e16d/aiokafka/producer/producer.py#L286-L294