Skip to content

Commit

Permalink
🐛 fix(sqla): don't cache AsyncSession dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramRipper committed Feb 25, 2024
1 parent 00f0f0b commit 5ebcc57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nonebot_plugin_orm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def get_session(**local_kw: Any) -> sa_async.AsyncSession:

# NOTE: NoneBot DI will run sync function in thread pool executor,
# which is poor performance for this simple function, so we wrap it as a coroutine function.
AsyncSession = Annotated[sa_async.AsyncSession, Depends(coroutine(get_session))]
AsyncSession = Annotated[
sa_async.AsyncSession, Depends(coroutine(get_session), use_cache=False)
]


def get_scoped_session() -> sa_async.async_scoped_session[sa_async.AsyncSession]:
Expand Down

0 comments on commit 5ebcc57

Please sign in to comment.