refactor: raise error if tenant service is not available

This commit is contained in:
Jonathan Kössler 2024-11-12 13:30:21 +01:00
parent 9906f68e0a
commit ed2bd1ec86

View File

@ -273,15 +273,20 @@ class AsyncQueueManager:
@retry(
tries=5,
exceptions=(AMQPConnectionError, ChannelInvalidStateError),
exceptions=(
AMQPConnectionError,
ChannelInvalidStateError,
aiohttp.ClientResponseError,
aiohttp.ClientConnectorError,
),
reraise=True,
)
async def initialize_tenant_queues(self) -> None:
try:
active_tenants = await self.fetch_active_tenants()
except (aiohttp.ClientResponseError, aiohttp.ClientConnectorError):
logger.warning("API calls to tenant server failed. No tenant queues initialized.", exc_info=True)
active_tenants = set()
logger.error("API calls to tenant server failed. No tenant queues initialized.", exc_info=True)
raise asyncio.CancelledError
for tenant_id in active_tenants:
await self.create_tenant_queues(tenant_id)