Correct stop of loop, mysql and influx
This commit is contained in:
@@ -34,4 +34,4 @@ async def internal_loop(influxdb_client: InfluxDBClientAsync, mysql_client: Asyn
|
||||
execution_model: list[ExecutionModel] = await execution_query.get_execution_by_id(293)
|
||||
res = [i.asdict() for i in execution_model]
|
||||
print(res[0]['id'])
|
||||
await asyncio.sleep(2)
|
||||
await asyncio.sleep(5)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import AsyncGenerator
|
||||
|
||||
from sqlalchemy.ext.asyncio import (create_async_engine, AsyncSession,
|
||||
async_sessionmaker, AsyncEngine)
|
||||
|
||||
@@ -44,7 +46,8 @@ def get_mysql_engine() -> AsyncEngine:
|
||||
def get_mysql_session_local() -> AsyncSession:
|
||||
return mysql_SessionLocal()
|
||||
|
||||
async def get_mysql_db():
|
||||
async def get_mysql_db() -> AsyncGenerator[AsyncSession]:
|
||||
"""FastAPI dependency for providing DB sessions"""
|
||||
async with get_mysql_session_local() as session:
|
||||
print(f"{session=}")
|
||||
yield session
|
||||
|
||||
Reference in New Issue
Block a user