Skip to content

Commit 5ebcc57

Browse files
committed
🐛 fix(sqla): don't cache AsyncSession dependency
1 parent 00f0f0b commit 5ebcc57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nonebot_plugin_orm/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ def get_session(**local_kw: Any) -> sa_async.AsyncSession:
120120

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

125127

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

0 commit comments

Comments
 (0)