fix: 修复 WebAgent 会话与选择状态 (#7266)

* fix(agent): preserve WebAgent session state

* test: separate subscription pressure coordination and owner waits

---------

Co-authored-by: jxxghp <jxxghp@gmail.com>
This commit is contained in:
SmallSpider
2026-11-01 17:49:20 +08:00
committed by GitHub
parent 1d840b834e
commit 7f227857d8
17 changed files with 661 additions and 48 deletions

View File

@@ -345,6 +345,8 @@ class _ScaleTorrentHelper:
# 线程同步最多等待 5 秒,避免验收异常时无限挂起。
_SITE_PRESSURE_SYNC_TIMEOUT = 5.0
# 执行方退出单独计时,故障注入可缩短收口等待而不影响请求竞争场景的建立。
_SITE_PRESSURE_JOIN_TIMEOUT = 5.0
class _ScaleSiteRequestBoundary:
@@ -574,7 +576,7 @@ def _run_site_pressure_case(
contention_observed = pressure_event.wait(timeout=_SITE_PRESSURE_SYNC_TIMEOUT)
boundary.release_first.set()
for thread in threads:
thread.join(timeout=_SITE_PRESSURE_SYNC_TIMEOUT)
thread.join(timeout=_SITE_PRESSURE_JOIN_TIMEOUT)
owners_finished = all(not thread.is_alive() for thread in threads)
initial_deferrals = [