mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-21 22:17:59 +00:00
make sure db connection for request is open
This commit is contained in:
parent
2fcaea85ae
commit
02ac1fa53b
|
@ -235,9 +235,6 @@ class Response(AiohttpResponse):
|
|||
|
||||
|
||||
class View(AbstractView):
|
||||
conn: Connection
|
||||
|
||||
|
||||
def __await__(self) -> Generator[Response]:
|
||||
if (self.request.method) not in METHODS:
|
||||
raise HTTPMethodNotAllowed(self.request.method, self.allowed_methods)
|
||||
|
@ -250,6 +247,9 @@ class View(AbstractView):
|
|||
|
||||
async def _run_handler(self, handler: Awaitable) -> Response:
|
||||
with self.database.config.connection_class(self.database) as conn:
|
||||
# todo: remove on next tinysql release
|
||||
conn.open()
|
||||
|
||||
return await handler(self.request, conn, **self.request.match_info)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue