test with redfish logout

This commit is contained in:
2025-11-13 13:14:05 +01:00
parent 7d1de29af3
commit 2752103a3d

View File

@@ -269,16 +269,18 @@ async def run_exporter(config, stop_event):
# Connection pooling with aiohttp # Connection pooling with aiohttp
connector = aiohttp.TCPConnector(limit_per_host=5, limit=50, ttl_dns_cache=300) connector = aiohttp.TCPConnector(limit_per_host=5, limit=50, ttl_dns_cache=300)
async with aiohttp.ClientSession(connector=connector) as session: async with aiohttp.ClientSession(connector=connector) as session:
hosts = [HostConfig(**h) for h in config["hosts"]] try:
while not stop_event.is_set(): while not stop_event.is_set():
tasks = [get_power_data(session, hc) for hc in host_objs] tasks = [get_power_data(session, hc) for hc in host_objs]
await asyncio.gather(*tasks) await asyncio.gather(*tasks)
await process_request(interval) await process_request(interval)
# shutdown service finally:
# Graceful shutdown: logout from Redfish sessions
logging.info("Exporter stopping, logging out from Redfish sessions...") logging.info("Exporter stopping, logging out from Redfish sessions...")
await asyncio.gather(*(logout_host(session, h) for h in hosts if h.session_token)) await asyncio.gather(
*(logout_host(session, h) for h in host_objs if h.session_token)
)
logging.info("All sessions logged out.")
logging.info("Exporter stopped cleanly.") logging.info("Exporter stopped cleanly.")