3
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user