From 8a8174942b899781a15c7ddf0ce142868f37be95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:34:40 +0800 Subject: [PATCH] retry --- LunaTranslator/LunaTranslator/metadata/abstract.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/LunaTranslator/LunaTranslator/metadata/abstract.py b/LunaTranslator/LunaTranslator/metadata/abstract.py index fc701c7f..13c66d79 100644 --- a/LunaTranslator/LunaTranslator/metadata/abstract.py +++ b/LunaTranslator/LunaTranslator/metadata/abstract.py @@ -68,7 +68,11 @@ class common: while True: pair = self.__tasks_searchfordata.get() - gameuid, vid = pair + if len(pair) == 2: + gameuid, vid = pair + retrytime = 5 + elif len(pair) == 3: + gameuid, vid, retrytime = pair remove = True try: self.__do_searchfordata(gameuid, vid) @@ -83,7 +87,11 @@ class common: self.__safe_remove_task("searchfordatatasks", pair) else: - self.__tasks_searchfordata.put((gameuid, vid)) + if retrytime: + # 尝试5次仍不行则放弃 + self.__tasks_searchfordata.put((gameuid, vid, retrytime - 1)) + else: + self.__safe_remove_task("searchfordatatasks", pair) gobject.baseobject.translation_ui.displayglobaltooltip.emit(vis) def __tasks_downloadimg_thread(self):