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("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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user