Repository navigation
test(group-send): 跨上限用例改用等比缩小的上限,消除 bun-test 高负载超时 - #3324
Merged
Merged
Conversation
两个用例要靠真实发送跨过 2000 条 live 上限,每次发送都整份读、校验、 重写 live 文件,总量是 N² 级 CPU 活:本机两例 49 秒,关掉 fsync 仍要 31 秒,所以加宽超时或关 fsync 都消不掉负载敏感。 服务加 __setGroupSendLimitsForTest 测试缝(生产恒用原常量),这两例按 1/50 等比缩小上限跑;生产上限的压缩批量与归档上限改由种子文件各发一次 校验。顺带补上「发送成功不写 sentAt」此前无用例咬红的缺口。整份文件 从约 48 秒降到 1.5 秒,去掉 120 秒超时放宽。 Fixes #3323 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 10, 2026 23:54
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 c100770…8ec203230(5 个提交),同批合入的还有 #3299 #3308 #3306 #3301,失败不一定由本 PR 引起。
|
This was referenced Nov 11, 2026
|
🚀 Released in v3.59.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#3323:master 合后 CI 的 bun-test 里,
request-bound-group-send.test.ts的「第 2002 个新 requestId 仍能发送」超过 120 秒预算(实测 133 秒)。同文件另一个用例keeps the active file at the live cap …也从本地 26 秒涨到 61 秒。根因(实测)
这两个用例都要靠真实发送跨过 2000 条的 live 上限。服务每次发送都要整份读取并校验 live 文件(每条记录算一次 sha256 校验 uuid),再整份重写,所以跨过上限是 N² 级的 CPU 活。fsync 只占一部分:
关掉 fsync 只省约 37%,剩下的开销随 CPU 负载线性放大(CI 这次整体慢 4–5.7 倍)。所以加宽超时或只关 fsync 都消不掉负载敏感,需要减少跨上限要做的工作量。
改动
src/services/request-bound-group-send.ts:limits读取,默认值是原来的三个导出常量,冻结不可改。__setGroupSendLimitsForTest(limits | null),只给测试用:会校验参数,传null恢复生产值。test/request-bound-group-send.test.ts:GROUP_SEND_COMPACT_BATCH条)和归档上限,改为各用种子文件发一次来校验,不再靠几千次真实发送堆出来。sentAt时,原来没有任何用例会变红(见下面变异 M9)。vi.setConfig({ testTimeout: 120_000 })和两个用例的 120 秒第三参。afterEach恢复生产上限。影响面
limits,默认值逐字相同。持久化格式、上限数值、压缩与淘汰顺序都不变,不涉及持久状态语义变化。验证
bun run typecheck、bun run build通过。request-bound-group-send.test.ts33/33、test-hygiene.test.ts通过。整份文件的用例耗时从约 48 秒降到 1.45 秒。bun test --timeout=18000033/33,用时 1.54 秒;不带超时参数(bun 默认每例 5 秒)也是 33/33,1.55 秒。master 旧用例每轮约 45 秒,本 PR 每轮约 10 秒(大部分是 vitest 的转译和导入时间)。
Fixes #3323
🤖 Generated with Claude Code