This commit is contained in:
2026-01-28 06:59:22 +08:00
parent eb255fdf77
commit e43bd390f0

View File

@@ -2416,8 +2416,15 @@ class ProvisionerBot:
skipped.append(key) skipped.append(key)
continue continue
# 测试 Key 是否有效 # 测试 Key 是否有效 (使用线程池避免阻塞,带超时)
success, msg = gptmail_service.test_api_key(key) try:
success, msg = await asyncio.wait_for(
asyncio.to_thread(gptmail_service.test_api_key, key),
timeout=15
)
except asyncio.TimeoutError:
invalid.append(key)
continue
if not success: if not success:
invalid.append(key) invalid.append(key)