File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ def _init_orm():
111111 lambda : id (current_event .get (None )),
112112 )
113113
114+ # XXX: workaround for https://github.com/nonebot/nonebot2/issues/2475
115+ event_postprocessor (_clear_scoped_session )
116+ run_postprocessor (_close_scoped_session )
117+
114118
115119@wraps (lambda : None ) # NOTE: for dependency injection
116120def get_session (** local_kw : Any ) -> sa_async .AsyncSession :
@@ -135,13 +139,13 @@ async def get_scoped_session() -> sa_async.async_scoped_session[sa_async.AsyncSe
135139]
136140
137141
138- @event_postprocessor
142+ # @event_postprocessor
139143def _clear_scoped_session (event : Event ) -> None :
140144 with suppress (KeyError ):
141145 del _scoped_sessions .registry [id (event )]
142146
143147
144- @run_postprocessor
148+ # @run_postprocessor
145149async def _close_scoped_session (event : Event , matcher : Matcher ) -> None :
146150 with suppress (KeyError ):
147151 session : sa_async .AsyncSession = _scoped_sessions .registry [
You can’t perform that action at this time.
0 commit comments