Merge pull request 'fix: make startup and shutdown event handlers async in common provider' (#24) from Nicolas_devops_reconciler into dev

Reviewed-on: freeleaps/freeleaps-service-hub#24
This commit is contained in:
freeleaps-admin 2025-08-08 05:02:21 +00:00
commit 6e1cb5962f
2 changed files with 5 additions and 3 deletions

View File

@ -37,8 +37,10 @@ class AsyncMQClient:
name=self.exchange_name, type="direct", auto_delete=False name=self.exchange_name, type="direct", auto_delete=False
) )
# Connect to existing named queue instead of creating anonymous queue
# channel_name already contains the full queue name from environment variable
self.queue = await self.channel.declare_queue( self.queue = await self.channel.declare_queue(
name=None, exclusive=True, auto_delete=True, durable=False name=self.channel_name, exclusive=False, auto_delete=False, durable=True
) )
await self.queue.bind( await self.queue.bind(
exchange=self.exchange, routing_key=self.routing_key exchange=self.exchange, routing_key=self.routing_key

View File

@ -11,13 +11,13 @@ def register(app):
# This hook ensures that a connection is opened to handle any queries # This hook ensures that a connection is opened to handle any queries
# generated by the request. # generated by the request.
@app.on_event("startup") @app.on_event("startup")
def startup(): async def startup():
pass pass
# This hook ensures that the connection is closed when we've finished # This hook ensures that the connection is closed when we've finished
# processing the request. # processing the request.
@app.on_event("shutdown") @app.on_event("shutdown")
def shutdown(): async def shutdown():
pass pass