Skip to content

Commit e7defe2

Browse files
Merge pull request #870 from felipehertzer/patch-1
Close connection on rollback [MySQL]
2 parents c11fcc4 + 378b8c3 commit e7defe2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/masoniteorm/connections/MySQLConnection.py

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ def rollback(self):
124124
"""Transaction"""
125125
self._connection.rollback()
126126
self.transaction_level -= 1
127+
if self.get_transaction_level() <= 0:
128+
self.open = 0
129+
self._connection.close()
127130

128131
def get_transaction_level(self):
129132
"""Transaction"""

0 commit comments

Comments
 (0)