简化登录流程:砍掉代理池,极验不内部切代理

- 新建 ProxyFetcher 替代 ProxyManager,每次从API取1个代理,无池无锁无冷却
- 极验最多3次尝试,失败直接抛异常回到login整体重试取新代理
- 删掉极验内部的 refresh_proxy/proxy_switches/_soft_fail_streak 逻辑
- login整体重试时取新代理从头走完整流程
- 代理验证超时从(5,8)缩短为(3,5),白名单同步后立即重试不等待
- login_service 删掉60行代理池预检/等待代码
- 修复邮件验证码日期比较:Roundcube分钟精度与秒级时间戳对齐
This commit is contained in:
yml2213
2026-06-24 15:37:48 +08:00
parent ca5bf3531d
commit e478ac4d09
7 changed files with 162 additions and 278 deletions
+9 -4
View File
@@ -155,18 +155,23 @@ class ProxyManager:
return None
def _fetch_and_verify_all(self, max_attempts: int) -> tuple[Optional[list[str]], str]:
"""调代理 API 获取一批代理,并发验证所有可用代理。"""
"""调代理 API 获取一批代理,并发验证
对短效代理友好:拿到第一个可用代理就立即返回,
不再等所有代理验证完毕(验证期间短效代理会过期浪费)。
"""
resolver = ProxyResolver(
api_url=self.api_url,
whitelist_syncer=self._whitelist_syncer,
sync_local_exit_ip=bool(self._whitelist_syncer),
sync_whitelist_once=False,
)
available, msg = resolver.fetch_verified(max_attempts=max_attempts, return_all=True)
if isinstance(available, list):
return available, msg
# return_all=False: 找到第一个可用就返回,节省短效代理时间
available, msg = resolver.fetch_verified(max_attempts=max_attempts, return_all=False)
if isinstance(available, str):
return [available], msg
if isinstance(available, list):
return available, msg
return None, msg
def mark_bad(self, proxy_url: str) -> None: