From 1d6fa13a948d6cc7ecb9b945945714340e47adb7 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 25 Jul 2020 13:25:23 +0800 Subject: [PATCH] Update qbittorrent_worker.py --- plugins/qbittorrent/workers/qbittorrent_worker.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/qbittorrent/workers/qbittorrent_worker.py b/plugins/qbittorrent/workers/qbittorrent_worker.py index 18322e378..faca6e366 100755 --- a/plugins/qbittorrent/workers/qbittorrent_worker.py +++ b/plugins/qbittorrent/workers/qbittorrent_worker.py @@ -140,9 +140,12 @@ class downloadBT(Thread): return True except Exception as e: self.__db_err = e - sys.exit('未连接数据库!') return False + def __check(self): + if not __db_err: + sys.exit('未连接数据库!') + def __close(self): self.dbcurr.close() self.dbconn.close() @@ -619,7 +622,7 @@ class downloadBT(Thread): def check_task(self): while True: - self.__conn() + self.__check() torrents = self.qb.torrents(filter='downloading') tlen = len(torrents) if tlen > 0: @@ -642,7 +645,7 @@ class downloadBT(Thread): def completed(self): while True: - self.__conn() + self.__check() torrents = self.qb.torrents(filter='completed') if not torrents: continue