From 73bad8fa05e3a25bbe34ba51731c05b162473b01 Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 13 Jan 2019 14:29:35 +0100 Subject: [PATCH] Increase number of attempts to write to Kodi DB - Partially fixes #593 --- resources/lib/kodi_db/common.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/lib/kodi_db/common.py b/resources/lib/kodi_db/common.py index 08f466eb..dc9984c1 100644 --- a/resources/lib/kodi_db/common.py +++ b/resources/lib/kodi_db/common.py @@ -7,17 +7,20 @@ from functools import wraps from .. import utils, path_ops, app KODIDB_LOCK = Lock() +DB_WRITE_ATTEMPTS = 10 def catch_operationalerrors(method): @wraps(method) def wrapped(*args, **kwargs): - attempts = 3 + attempts = DB_WRITE_ATTEMPTS while True: try: return method(*args, **kwargs) - except utils.OperationalError: - app.APP.monitor.waitForAbort(0.01) + except utils.OperationalError as err: + if 'database is locked' not in err: + raise + app.APP.monitor.waitForAbort(0.05) attempts -= 1 if attempts == 0: raise