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

Skip to content

Commit a94dcf9

Browse files
committed
Patch for an Issue #1226đ
1 parent bb98894 commit a94dcf9

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

lib/utils/api.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,17 @@ def commit(self):
7777
self.connection.commit()
7878

7979
def execute(self, statement, arguments=None):
80-
if arguments:
81-
self.cursor.execute(statement, arguments)
82-
else:
83-
self.cursor.execute(statement)
80+
while True:
81+
try:
82+
if arguments:
83+
self.cursor.execute(statement, arguments)
84+
else:
85+
self.cursor.execute(statement)
86+
except sqlite3.OperationalError, ex:
87+
if not "locked" in ex.message:
88+
raise
89+
else:
90+
break
8491

8592
if statement.lstrip().upper().startswith("SELECT"):
8693
return self.cursor.fetchall()

0 commit comments

Comments
 (0)