feat: 维护台 maintain(巡检/补号/日志)+ 配置与 .gitignore
- Flask 控制台:Cliproxy 巡检、批量补号、流水线、运行日志 - codex_stats_oauth_dir 支持统计 Cliproxy auth 目录 - 忽略 accounts/oauth、.venv、本地 DB/日志与 new.py Made-with: Cursor
This commit is contained in:
1 parent
ebef9acd7c
commit
a089da31cd
23 files changed
+3719
-631
No files matched your search
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""验证批量补号链路:run_batch 并行、计数、register context 清理(不真实打注册接口)。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if ROOT not in sys.path:
|
||||
sys.path.insert(0, ROOT)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
import run as run_module
|
||||
from maintain.batch_register import run_batch
|
||||
|
||||
calls: list[int] = []
|
||||
|
||||
def fake_do_one(index: int, config, proxy: str, skip_oauth: bool) -> dict:
|
||||
calls.append(index)
|
||||
run_module._counter["success"] += 1
|
||||
return {}
|
||||
|
||||
orig = run_module._do_one
|
||||
run_module._do_one = fake_do_one # type: ignore[assignment]
|
||||
try:
|
||||
ok, fail = run_batch(
|
||||
count=5,
|
||||
threads=3,
|
||||
proxy="",
|
||||
skip_oauth=False,
|
||||
cpa_id=1,
|
||||
cpa_code="default",
|
||||
on_progress=None,
|
||||
)
|
||||
assert ok == 5 and fail == 0, (ok, fail)
|
||||
assert len(calls) == 5 and set(calls) == {1, 2, 3, 4, 5}, calls
|
||||
assert getattr(run_module._register_ctx, "cpa_id", None) is None
|
||||
assert getattr(run_module._register_ctx, "cpa_code", None) is None
|
||||
finally:
|
||||
run_module._do_one = orig # type: ignore[assignment]
|
||||
|
||||
print("verify_batch_register: OK (mocked _do_one, count=5 threads=3)")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user