This commit is contained in:
2026-01-27 09:47:12 +08:00
parent c937bc7356
commit a973343b48
3 changed files with 273 additions and 158 deletions

8
run.py
View File

@@ -62,6 +62,7 @@ _tracker = None
_current_results = []
_shutdown_requested = False
_tracker_lock = threading.Lock() # 用于并发时保护 tracker 操作
_auth_callback_lock = threading.Lock() # 授权回调锁 - 确保同一时间只有一个线程进行授权回调
def _save_state():
@@ -228,7 +229,7 @@ def process_single_team(team: dict, team_index: int = 0, teams_total: int = 0) -
# ========== 阶段 3: 处理所有账号 (注册 + Codex 授权 + 入库) ==========
if all_to_process:
# 根据配置选择串行或并发处理
# 根据配置选择处理模式
if CONCURRENT_ENABLED and len(all_to_process) > 1:
log.section(f"阶段 3: 并发处理 {len(all_to_process)} 个账号 (并发数: {min(CONCURRENT_WORKERS, len(all_to_process))})")
all_results = process_accounts_concurrent(
@@ -786,7 +787,8 @@ def process_accounts_concurrent(
total = len(pending_accounts)
actual_workers = min(max_workers, total)
log.section(f"并发处理 {total} 个账号 (并发数: {actual_workers}, 间隔: {stagger_delay}s)")
# 并发注册,串行授权回调
log.section(f"并发处理 {total} 个账号 (并发数: {actual_workers}, 授权回调串行)")
# 启动进度跟踪
progress_start(team_name, total, team_index, teams_total, include_owner)
@@ -881,7 +883,7 @@ def _print_system_config():
# 并发配置
if CONCURRENT_ENABLED:
log.info(f"并发处理: ✓ 开启 ({CONCURRENT_WORKERS} 并发)", icon="config")
log.info(f"并发处理: ✓ 开启 ({CONCURRENT_WORKERS} 并发, 授权串行)", icon="config")
else:
log.info("并发处理: ✗ 关闭 (串行模式)", icon="config")