Commit 86db8d20 authored by Domenico Giordano's avatar Domenico Giordano
Browse files

change retry counter

parent 9bbe7b28
......@@ -19,27 +19,27 @@ def modify_db(conn,
"""
with conn.cursor() as c:
for x in range(0, 10):
for x in range(1, 11):
try:
if args:
c.execute(query, args)
else:
c.execute(query)
except:
print("Sqlite3 execute unsuccessful, retrying....")
time.sleep(1)
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(0, 10):
for x in range(1, 11):
try:
conn.commit()
except:
print("Sqlite3 commit unsuccessful, retrying....")
time.sleep(1)
print("Sqlite3 commit unsuccessful, retrying after %s sec...." %x)
time.sleep(x)
pass
else:
print("Sqlite3 commit successful, breaking the retry cycle.")
......
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