Skip to content

Commit

Permalink
fixes aio-libs#886, simple fixes for twophase methods
Browse files Browse the repository at this point in the history
  • Loading branch information
olegm committed Dec 16, 2021
1 parent 7ac2d29 commit 11cfd9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aiopg/sa/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ async def _prepare_twophase_impl(self, xid):
async def recover_twophase(self):
"""Return a list of prepared twophase transaction ids."""
result = await self.execute("SELECT gid FROM pg_prepared_xacts")
return [row[0] for row in result]
return [row[0] async for row in result]

async def rollback_prepared(self, xid, *, is_prepared=True):
"""Rollback prepared twophase transaction."""
if is_prepared:
await self.execute(f"ROLLBACK PREPARED {xid:!r}")
await self.execute(f"ROLLBACK PREPARED {xid!r}")
else:
await self._rollback_impl()

Expand Down
1 change: 0 additions & 1 deletion docs/sa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ Connection

.. comethod:: begin_twophase(xid=None)
:coroutine:
:async-with:

Begin a two-phase or XA transaction and return a transaction
handle.
Expand Down

0 comments on commit 11cfd9d

Please sign in to comment.