feat: tune cmhub image timeouts
This commit is contained in:
+10
-1
@@ -3,7 +3,7 @@ id: T-553
|
||||
title: cmhub 生图超时口径调优(连接 66 秒,读取 900 秒)
|
||||
phase: 7
|
||||
deps: [T-535, T-545, T-547, T-548]
|
||||
status: TODO
|
||||
status: DONE
|
||||
created: 2026-07-08
|
||||
---
|
||||
|
||||
@@ -50,3 +50,12 @@ cmhub 项目侧建议:桌面端连接超时提高到 60/120 秒量级;生图
|
||||
## 边界(不改什么)
|
||||
|
||||
只改 cmhub 连接超时默认值、生图读取等待常量、⑤设置页显示文案、相关单测和文档;不改 cmhub API 协议、Base URL/Key/别名配置结构、标题读取等待 600 秒、图片并发上限 5、下载线程池语义、DB、Excel、Shopee/CDP 更新流程,也不增加生图读超时重试。
|
||||
|
||||
## 执行记录
|
||||
|
||||
- 2026-07-08:完成 T-553。
|
||||
- 代码:`app/appconfig.py` 新增 `CMHUB_CONNECT_TIMEOUT_DEFAULT=66` 和旧默认 `10` 的读取迁移逻辑;读取旧 `data/config.json` 时缺失或旧默认 `10` 会归一为 `66`,但用户后续显式保存 `10` 仍会保留,避免堵死高级调试。
|
||||
- 代码:`app/ai.py` 将 `CMHUB_IMAGE_READ_TIMEOUT_SECONDS` 从 `650` 改为 `900`,生图请求、requests 下载与 curl `--max-time` 继续共用该常量;生图读超时仍不自动重发。
|
||||
- 代码:`app/gui/tabs/settings.py` 的 cmhub 连接超时默认值改为 `66`,⑤设置页「返回超时」通过常量展示为「标题 600 秒 / 图片 900 秒」。
|
||||
- 测试:`tests/test_appconfig.py` 覆盖新默认 66、旧默认 10 读取迁移、显式保存 10 保留;`tests/test_ai.py` 覆盖生图请求/下载/curl/read timeout 的 900 秒口径;`tests/test_gui.py` 更新设置页展示断言。
|
||||
- 验证:`python -m ruff check app tests main.py` 通过;`py -3.10 -m compileall app main.py` 通过;`git diff --check` 通过;`py -3.10 -m unittest tests.test_appconfig tests.test_ai tests.test_gui` 通过(160 tests);`py -3.10 -m unittest discover -s tests` 通过(257 tests)。
|
||||
|
||||
Reference in New Issue
Block a user