mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.25k stars 189 forks source link

connection.close() Been waiting | help me #640

Open Y7000-save-me opened 3 months ago

Y7000-save-me commented 3 months ago

async def disconnect(self): if self.connection and not self.connection.is_closed: logger.info(f"close RabbitMQ connection1") try: await self.connection.close() logger.info(f"close RabbitMQ connection2") except Exception as e: logger.error(f"Failed to close RabbitMQ connection: {e}")

async def on_shutdown(): await rabbit_mq.disconnect()

app.add_event_handler("shutdown", on_shutdown)

log INFO: Shutting down INFO: Waiting for application shutdown. 2024-07-26 16:42:28.703 | INFO | agentic.base.mq.client:disconnect:52 - close RabbitMQ connection1

The connection won't shut down

antonparshukov00 commented 2 months ago

Version: aio-pika 9.4.1 Faced same/similar problem. Code is waiting forever on the closing. Will try to explore more. image