From ab396b01f2527c57634b979dfba75281562f3bb7 Mon Sep 17 00:00:00 2001 From: MangoFanFanw Date: Sun, 24 May 2026 14:59:45 +0800 Subject: [PATCH] =?UTF-8?q?style(otp.py):=20=E5=B0=86=E6=B8=85=E7=90=86?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E7=9A=84=E5=AE=9A=E6=9C=9F=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=99=8D=E7=BA=A7=E4=B8=BA=20debug=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=85=E7=90=86=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nyahome/core/core_abc/otp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nyahome/core/core_abc/otp.py b/src/nyahome/core/core_abc/otp.py index b2b4f52..a0d3d4b 100644 --- a/src/nyahome/core/core_abc/otp.py +++ b/src/nyahome/core/core_abc/otp.py @@ -42,15 +42,17 @@ class OtpMemoryStore(ABC): async def _cleanup(self) -> None: while True: await asyncio.sleep(60) - logger.info(f"[{self.type_name}] 开始定时清理过期验证码。") + logger.debug(f"[{self.type_name}] 开始定时清理过期验证码。") expires = [] + count = 0 for address, item in self._store.items(): if item.expire_time < time.time(): logger.debug(f"[{self.type_name}] 移除过期的 {address}") expires.append(address) + count += 1 for address in expires: self._store.pop(address) - logger.info(f"[{self.type_name}] 清理完成。") + logger.debug(f"[{self.type_name}] 清理完成,清理了 {count} 个过期验证码。") def verify(self, address: str, user_id: int, verify_code: str) -> bool: item = self._store.get(address)