T-580 精简设置页更新执行配置

This commit is contained in:
chengma
2026-07-10 10:12:15 +08:00
parent c078e68e98
commit e70e831afa
12 changed files with 259 additions and 287 deletions
+40 -8
View File
@@ -46,6 +46,8 @@ AI_CONCURRENCY_MIN = 1
AI_CONCURRENCY_MAX = 5
AI_RETRY_MIN = 0
AI_RETRY_MAX = 10
SHOPEE_PARALLEL_ACCOUNTS_MIN = 1
SHOPEE_PARALLEL_ACCOUNTS_MAX = 5
CMHUB_CONNECT_TIMEOUT_DEFAULT = 66
CMHUB_CONNECT_TIMEOUT_OLD_DEFAULT = 10
RUNTIME_CONFIG_KEYS = {
@@ -105,14 +107,10 @@ DEFAULT_CONFIG = {
},
"shopee_update": {
"test_item_id": "51100639510",
"allow_real_submit": False,
"allow_cover_update": False,
"update_mode": "",
"max_items_per_run": 1,
"close_success_tab": False,
"dry_run": False,
"parallel_accounts": False,
"max_parallel_accounts": 2,
"max_parallel_accounts": 1,
},
}
@@ -396,11 +394,30 @@ def _normalize_config_values(config, migrate_old_cmhub_connect_timeout=False):
)
update = config.get("shopee_update")
if isinstance(update, dict):
old_parallel_accounts = update.pop("parallel_accounts", None)
old_allow_cover_update = update.get("allow_cover_update", False)
update.pop("allow_real_submit", None)
update.pop("allow_cover_update", None)
update.pop("close_success_tab", None)
update["update_mode"] = normalize_update_mode(
update.get("update_mode"),
allow_cover_update=update.get("allow_cover_update", False),
allow_cover_update=old_allow_cover_update,
)
if old_parallel_accounts is False:
update["max_parallel_accounts"] = SHOPEE_PARALLEL_ACCOUNTS_MIN
else:
update["max_parallel_accounts"] = _clamp_int(
update.get("max_parallel_accounts"),
SHOPEE_PARALLEL_ACCOUNTS_MIN,
SHOPEE_PARALLEL_ACCOUNTS_MAX,
DEFAULT_CONFIG["shopee_update"]["max_parallel_accounts"],
)
update["max_items_per_run"] = _clamp_int(
update.get("max_items_per_run"),
1,
9999,
DEFAULT_CONFIG["shopee_update"]["max_items_per_run"],
)
update["allow_cover_update"] = update_mode_includes_cover(update["update_mode"])
return config
@@ -693,7 +710,22 @@ def shopee_update_config(config=None) -> dict:
merged.get("update_mode"),
allow_cover_update=merged.get("allow_cover_update", False),
)
merged["allow_cover_update"] = update_mode_includes_cover(merged["update_mode"])
if merged.get("parallel_accounts") is False:
merged["max_parallel_accounts"] = SHOPEE_PARALLEL_ACCOUNTS_MIN
else:
merged["max_parallel_accounts"] = _clamp_int(
merged.get("max_parallel_accounts"),
SHOPEE_PARALLEL_ACCOUNTS_MIN,
SHOPEE_PARALLEL_ACCOUNTS_MAX,
DEFAULT_CONFIG["shopee_update"]["max_parallel_accounts"],
)
for removed_key in (
"allow_real_submit",
"allow_cover_update",
"close_success_tab",
"parallel_accounts",
):
merged.pop(removed_key, None)
return merged