forked from LBRYCommunity/lbry-sdk
bump attempts to 5 and properly check failure
This commit is contained in:
parent
5e371e8e6a
commit
2a285d139a
1 changed files with 2 additions and 2 deletions
|
@ -52,13 +52,13 @@ def open_file_for_writing(download_directory, suggested_file_name):
|
||||||
|
|
||||||
|
|
||||||
def rerun_if_locked(f):
|
def rerun_if_locked(f):
|
||||||
max_attempts = 3
|
max_attempts = 5
|
||||||
|
|
||||||
def rerun(err, rerun_count, *args, **kwargs):
|
def rerun(err, rerun_count, *args, **kwargs):
|
||||||
connection = args[0]
|
connection = args[0]
|
||||||
reactor = connection.reactor
|
reactor = connection.reactor
|
||||||
log.debug("Failed to execute (%s): %s", err, args)
|
log.debug("Failed to execute (%s): %s", err, args)
|
||||||
if err.check(sqlite3.OperationalError) and err.value.message == "database is locked":
|
if err.check(sqlite3.OperationalError) and "database is locked" in str(err.value):
|
||||||
log.warning("database was locked. rerunning %s with args %s, kwargs %s",
|
log.warning("database was locked. rerunning %s with args %s, kwargs %s",
|
||||||
str(f), str(args), str(kwargs))
|
str(f), str(args), str(kwargs))
|
||||||
if rerun_count < max_attempts:
|
if rerun_count < max_attempts:
|
||||||
|
|
Loading…
Reference in a new issue