Skip to content

🐛 修复 async_queue 压力测试在 CI 争抢下的超时误报#1600

Merged
CodFrm merged 1 commit into
scriptscat:mainfrom
cyfung1031:fix/async-queue-test-timeout
Jul 17, 2026
Merged

🐛 修复 async_queue 压力测试在 CI 争抢下的超时误报#1600
CodFrm merged 1 commit into
scriptscat:mainfrom
cyfung1031:fix/async-queue-test-timeout

Conversation

@cyfung1031

Copy link
Copy Markdown
Collaborator

Checklist / 检查清单

  • Fixes mentioned issues / 修复已提及的问题
  • Code reviewed by human / 代码通过人工检查
  • Changes tested / 已完成测试

Description / 描述

问题test.yaml 工作流(run 80078796006)在 Run tests job 中失败:

FAIL src/pkg/utils/async_queue.test.ts > stackAsyncTask 测试 > 【5】大量任务、递回不死锁 + 返回值正确
Error: Test timed out in 340ms.

该用例串行 await 3000 个堆叠任务并附带递归链,vitest.config.ts 中 "fast" project 的全局
testTimeout 为 340ms(针对普通用例的紧凑预算)。本地单测与全量覆盖率运行(--coverage
均稳定通过(约 87–88ms),说明并非逻辑缺陷,而是该用例本身真实耗时较高(约 300ms 级),
在 CI 共享 runner 的并发 worker 争抢下偶发超出预算,属于超时误报。

方案:比照仓库中 encoding.test.ts 对同类重量级用例(chardet 32KB 采样,同样逼近
340ms 预算)已采用的做法,仅为该用例通过 it.sequential(name, { timeout: 850 }, fn)
显式给出 850ms 单测预算,不放宽影响其余全部用例的全局超时。

验证

  • pnpm exec vitest run src/pkg/utils/async_queue.test.ts --project fast — 7/7 通过,该用例 87ms。
  • pnpm exec vitest run --project fast --coverage — 126 files / 2092 tests 全部通过。

Screenshots / 截图

不适用(纯测试配置调整,无 UI 变更)。

【5】大量任务、递回不死锁 用例串行 await 3000 个任务,在共享 CI runner 并发争抢下单次
实测超过全局 340ms 预算触发误报超时;本地隔离运行与全量覆盖率运行均稳定通过(~88ms),
非逻辑缺陷。比照 encoding.test.ts 的既有做法,为该重量级用例单独给予 850ms 预算,
不放宽全局超时。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@cyfung1031

Copy link
Copy Markdown
Collaborator Author

@CodFrm
CodFrm merged commit 2f4ac7b into scriptscat:main Jul 17, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants