remove exception catch in stopping phase
This commit is contained in:
16
main.py
16
main.py
@@ -29,15 +29,13 @@ async def startup(fast_api: FastAPI):
|
|||||||
print(f"{mysql_engine=}")
|
print(f"{mysql_engine=}")
|
||||||
print("mysql init done")
|
print("mysql init done")
|
||||||
task = asyncio.create_task(internal_loop(influxdb_client, mysql_client))
|
task = asyncio.create_task(internal_loop(influxdb_client, mysql_client))
|
||||||
try:
|
yield
|
||||||
yield
|
# Shutdown logic
|
||||||
finally:
|
await internal_loop_stop(task)
|
||||||
# Shutdown logic
|
await influxdb_client.close()
|
||||||
await internal_loop_stop(task)
|
mysql_engine = get_mysql_engine()
|
||||||
await influxdb_client.close()
|
await mysql_client.close()
|
||||||
mysql_engine = get_mysql_engine()
|
await mysql_engine.dispose()
|
||||||
await mysql_client.close()
|
|
||||||
await mysql_engine.dispose()
|
|
||||||
|
|
||||||
app = FastAPI(lifespan=startup)
|
app = FastAPI(lifespan=startup)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user