Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b99530

Browse files
committed
minor bug fix
1 parent d5cddd4 commit 9b99530

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/utils/hashdb.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, filepath):
2222
self.filepath = filepath
2323
self._write_cache = {}
2424
self._cache_lock = threading.Lock()
25+
self._in_transaction = False
2526

2627
def _get_cursor(self):
2728
threadData = getCurrentThreadData()
@@ -108,7 +109,11 @@ def flush(self, forced=False):
108109
self.endTransaction()
109110

110111
def beginTransaction(self):
111-
self.cursor.execute('BEGIN TRANSACTION')
112+
if not self._in_transaction:
113+
self.cursor.execute('BEGIN TRANSACTION')
114+
self._in_transaction = True
112115

113116
def endTransaction(self):
114-
self.cursor.execute('END TRANSACTION')
117+
if self._in_transaction:
118+
self.cursor.execute('END TRANSACTION')
119+
self._in_transaction = False

0 commit comments

Comments
 (0)