attempts to write to database thrice before moving on

This commit is contained in:
mcguirepr89
2022-04-19 14:42:14 -04:00
parent ad8c559605
commit 05d8b26fe6
+2
View File
@@ -356,6 +356,7 @@ def handle_client(conn, addr):
Date.replace("/", "-") + '-birdnet-' + Time + audiofmt Date.replace("/", "-") + '-birdnet-' + Time + audiofmt
#Connect to SQLite Database #Connect to SQLite Database
for attempt_number in range(3):
try: try:
con = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db') con = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db')
cur = con.cursor() cur = con.cursor()
@@ -363,6 +364,7 @@ def handle_client(conn, addr):
con.commit() con.commit()
con.close() con.close()
break
except: except:
print("Database busy") print("Database busy")
time.sleep(2) time.sleep(2)