remove exception catch in stopping phase

This commit is contained in:
marys
2025-09-26 11:53:45 +02:00
parent 433d6a0148
commit c3ac61b02b

16
main.py
View File

@@ -29,15 +29,13 @@ async def startup(fast_api: FastAPI):
print(f"{mysql_engine=}")
print("mysql init done")
task = asyncio.create_task(internal_loop(influxdb_client, mysql_client))
try:
yield
finally:
# Shutdown logic
await internal_loop_stop(task)
await influxdb_client.close()
mysql_engine = get_mysql_engine()
await mysql_client.close()
await mysql_engine.dispose()
yield
# Shutdown logic
await internal_loop_stop(task)
await influxdb_client.close()
mysql_engine = get_mysql_engine()
await mysql_client.close()
await mysql_engine.dispose()
app = FastAPI(lifespan=startup)