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:
commit
730905f827
@ -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
|
||||||
|
|||||||
@ -13,4 +13,5 @@ async def root():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
print("Starting FastAPI server...")
|
||||||
uvicorn.run("main:app", host=site_settings.SERVER_HOST, port=site_settings.SERVER_PORT, reload=True)
|
uvicorn.run("main:app", host=site_settings.SERVER_HOST, port=site_settings.SERVER_PORT, reload=True)
|
||||||
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import os
|
||||||
from app.backend.infra.rabbitmq.async_subscriber import AsyncMQSubscriber
|
from app.backend.infra.rabbitmq.async_subscriber import AsyncMQSubscriber
|
||||||
from app.backend.services.deployment_status_update_service import DeploymentStatusUpdateService
|
from app.backend.services.deployment_status_update_service import DeploymentStatusUpdateService
|
||||||
|
|
||||||
@ -15,7 +16,9 @@ def register(app):
|
|||||||
try:
|
try:
|
||||||
# Initialize services during startup to avoid blocking app initialization
|
# Initialize services during startup to avoid blocking app initialization
|
||||||
print("🔧 Initializing services...")
|
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()
|
app.deployment_status_service = DeploymentStatusUpdateService()
|
||||||
print("✅ Services initialized")
|
print("✅ Services initialized")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user