Merge pull request 'feat: merge dev branch to master to pick up the latest change' (#26) from dev into master

Reviewed-on: freeleaps/freeleaps-service-hub#26
This commit is contained in:
dax.li 2025-08-11 01:24:49 +00:00
commit 730905f827
4 changed files with 10 additions and 4 deletions

View File

@ -37,8 +37,10 @@ class AsyncMQClient:
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(
name=None, exclusive=True, auto_delete=True, durable=False
name=self.channel_name, exclusive=False, auto_delete=False, durable=True
)
await self.queue.bind(
exchange=self.exchange, routing_key=self.routing_key

View File

@ -13,4 +13,5 @@ async def root():
if __name__ == "__main__":
import uvicorn
print("Starting FastAPI server...")
uvicorn.run("main:app", host=site_settings.SERVER_HOST, port=site_settings.SERVER_PORT, reload=True)

View File

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

View File

@ -1,4 +1,5 @@
import asyncio
import os
from app.backend.infra.rabbitmq.async_subscriber import AsyncMQSubscriber
from app.backend.services.deployment_status_update_service import DeploymentStatusUpdateService
@ -15,7 +16,9 @@ def register(app):
try:
# Initialize services during startup to avoid blocking app initialization
print("🔧 Initializing services...")
app.deployment_heartbeat_subscriber = AsyncMQSubscriber("devops_reconcile_heartbeat")
output_queue_name = os.getenv("RABBITMQ_OUTPUT_QUEUE_NAME", "freeleaps.devops.reconciler.output")
print(f"Using output queue: {output_queue_name}")
app.deployment_heartbeat_subscriber = AsyncMQSubscriber(output_queue_name)
app.deployment_status_service = DeploymentStatusUpdateService()
print("✅ Services initialized")