Skip to content

Commit

Permalink
[patch] Added handling of malformed db files
Browse files Browse the repository at this point in the history
  • Loading branch information
Feramance committed Aug 8, 2023
1 parent 056cd6b commit 6e5916d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3015,6 +3015,20 @@ def run_request_search(self):
except NoConnectionrException as e:
self.logger.error(e.message)
raise DelayLoopException(length=300, type=e.type)
except peewee.DatabaseError as e:
self.logger.error(e.message)
included_extensions = ['db','db-shm', 'db-wal']
relevant_path = "/config"
file_names = [fn for fn in os.listdir(relevant_path) if any(fn.endswith(ext) for ext in included_extensions)]
for f in file_names:
os.remove(relevant_path+f)
relevant_path_2 = "/config"
file_names_2 = [fn for fn in os.listdir(relevant_path) if any(fn.endswith(ext) for ext in included_extensions)]
for f_2 in file_names_2:
os.remove(relevant_path_2+f_2)
cmd = "docker restart qbitrr"
os.system(cmd)
raise DelayLoopException(length=300, type=e.type)
except DelayLoopException:
raise
except Exception as e:
Expand Down Expand Up @@ -3095,6 +3109,20 @@ def run_search_loop(self) -> NoReturn:
self.logger.error(e.message)
self.manager.qbit_manager.should_delay_torrent_scan = True
raise DelayLoopException(length=300, type=e.type)
except peewee.DatabaseError as e:
self.logger.error(e.message)
included_extensions = ['db','db-shm', 'db-wal']
relevant_path = "/config"
file_names = [fn for fn in os.listdir(relevant_path) if any(fn.endswith(ext) for ext in included_extensions)]
for f in file_names:
os.remove(relevant_path+f)
relevant_path_2 = "/config"
file_names_2 = [fn for fn in os.listdir(relevant_path) if any(fn.endswith(ext) for ext in included_extensions)]
for f_2 in file_names_2:
os.remove(relevant_path_2+f_2)
cmd = "docker restart qbitrr"
os.system(cmd)
raise DelayLoopException(length=300, type=e.type)
except DelayLoopException:
raise
except ValueError:
Expand Down

0 comments on commit 6e5916d

Please sign in to comment.