Commit 52c78b22 authored by Domenico Giordano's avatar Domenico Giordano
Browse files

fix issue on sqlite3 with statement

parent 81b3a5d7
......@@ -18,20 +18,20 @@ def modify_db(conn,
additional arguments for execute query, optional
"""
with conn.cursor() as c:
for x in range(1, 11):
try:
if args:
c.execute(query, args)
else:
c.execute(query)
except:
print("Sqlite3 execute unsuccessful, retrying after %s sec...." %x)
time.sleep(x)
pass
c = conn.cursor()
for x in range(1, 11):
try:
if args:
c.execute(query, args)
else:
print("Sqlite3 execute successful, breaking the retry cycle.")
break
c.execute(query)
except:
print("Sqlite3 execute unsuccessful, retrying after %s sec...." %x)
time.sleep(x)
pass
else:
print("Sqlite3 execute successful, breaking the retry cycle.")
break
# retry commit - db might be locked by different process
for x in range(1, 11):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment