From 99e713a12919aeb672d5bceadfb439669d93ec93 Mon Sep 17 00:00:00 2001 From: Zzaphkiel Date: Mon, 24 Jun 2024 19:27:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=20`connector`=20=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E5=8F=B7=E9=87=8F=E5=88=9D=E5=A7=8B=E5=8C=96=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=90=AF=E5=8A=A8=E6=97=B6=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=90=AF=E5=8A=A8=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lol/connector.py | 10 ++++++---- app/view/main_window.py | 5 +---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/lol/connector.py b/app/lol/connector.py index 4a7adc8..5b51337 100644 --- a/app/lol/connector.py +++ b/app/lol/connector.py @@ -90,8 +90,10 @@ async def wrapper(*args, **kwargs): time.sleep(retry_sep) exce = e - if isinstance(e, SummonerNotFound): # SummonerNotFound 再重试会报 429 (限流) + # SummonerNotFound 再重试会报 429 (限流) + if isinstance(e, SummonerNotFound): raise e + continue else: break @@ -199,7 +201,9 @@ class LolClientConnector(QObject): def __init__(self): super().__init__() - self.semaphore = None + maxRefCnt = cfg.get(cfg.apiConcurrencyNumber) + + self.semaphore = asyncio.Semaphore(maxRefCnt) self.lcuSess = None self.sgpSess = None self.port = None @@ -209,7 +213,6 @@ def __init__(self): self.inMainLand = False self.manager = None - self.maxRefCnt = cfg.get(cfg.apiConcurrencyNumber) self.dqLock = threading.Lock() self.callStack = deque(maxlen=10) @@ -217,7 +220,6 @@ def __init__(self): async def start(self, pid): self.pid = pid self.port, self.token, self.server = getPortTokenServerByPid(pid) - self.semaphore = asyncio.Semaphore(self.maxRefCnt) await self.__initSessions() self.__initPlatformInfo() diff --git a/app/view/main_window.py b/app/view/main_window.py index a85b0ea..dab7f56 100644 --- a/app/view/main_window.py +++ b/app/view/main_window.py @@ -33,7 +33,7 @@ from app.common.logger import logger from app.common.signals import signalBus from app.components.message_box import (UpdateMessageBox, NoticeMessageBox, - WaitingForLolMessageBox, ExceptionMessageBox) + WaitingForLolMessageBox, ExceptionMessageBox,) from app.lol.exceptions import (SummonerGamesNotFound, RetryMaximumAttempts, SummonerNotFound, SummonerNotInGame, SummonerRankInfoNotFound) from app.lol.listener import (LolProcessExistenceListener, StoppableThread) @@ -83,9 +83,6 @@ def __init__(self): target=self.checkUpdate, parent=self) self.checkNoticeThread = StoppableThread( target=lambda: self.checkNotice(False), parent=self) - # 该功能不再支持 -- By Hpero4 - # self.minimizeThread = StoppableThread( - # target=self.gameStartMinimize, parent=self) logger.critical("Seraphine listerners started", TAG)