diff --git a/asyncdb/drivers/pg.py b/asyncdb/drivers/pg.py index 54403dae..4ef416c0 100644 --- a/asyncdb/drivers/pg.py +++ b/asyncdb/drivers/pg.py @@ -919,8 +919,10 @@ async def transaction(self): async def commit(self): if self._transaction: - await self._transaction.commit() - self._transaction = None + try: + await self._transaction.commit() + finally: + self._transaction = None async def rollback(self): if self._transaction: