fix(data): bs_eod挂死根治——login/logout纳入_with_timeout保护伞+中文系统运行判定三词修正。①根因(08-20 19:26实锤,日志形态逐字吻合):bs.login()打印success后仍有后续往返,baostock recv不遵守socket default timeout,主线程卡死在login内部recv(50min+零输出,连60s超时err都没有);fetch早已套_with_timeout但login/logout是裸调——relogin/login_once全部纳入(login60s/logout30s),超时按登录失败处理走既有重试链;②bs_fundamentals._is_running_text:中文系统实际输出「正在运行」不含连续子串「运行中」,原两词判定在中文VPS恒False=守卫恒fail-open(当晚若不禁用bs-fund将真撞车);三词都认+回归钉测试;③check_task_running.py通用探针(修复版)替换VPS上带同bug的check_bs_eod.py;+4测试(登录超时返False/relogin全程超时不raise/login与logout必经保护伞契约/正在运行判定) [vps]
CI/CD / test (push) Successful in 11s
CI/CD / nas-deploy (push) Successful in 28s
CI/CD / nas-verify (push) Successful in 10s

This commit is contained in:
2026-08-20 20:04:51 +08:00
parent d4a1305714
commit f28f9cf308
5 changed files with 66 additions and 5 deletions
+6 -3
View File
@@ -81,7 +81,10 @@ log = logging.getLogger(__name__)
def login_once():
try:
lg = bs.login()
# 2026-08-20 实锤: bs.login() 打印 "login success!" 后仍有后续往返, 服务端
# hiccup 时主线程可卡死在 login 内部 recv(08-20 19:26 挂死 50min+ 形态:
# logout✓ login success!打印后零输出) —— 与 fetch 同罩 _with_timeout。
lg = _with_timeout(bs.login, timeout=60)
if lg.error_code == "0":
return True
log.error("login fail: %s %s", lg.error_code, lg.error_msg)
@@ -93,14 +96,14 @@ def login_once():
def relogin():
try:
bs.logout()
_with_timeout(bs.logout, timeout=30)
except Exception:
pass
if login_once():
return True
time.sleep(2)
try:
bs.logout()
_with_timeout(bs.logout, timeout=30)
except Exception:
pass
return login_once()