Skip to content

test: 修复 hash-pool 抢占测试的时序竞态 - #36

Merged
xJasonShane merged 1 commit into
mainfrom
test/fix-hash-pool-preempt-flake
Nov 5, 2026
Merged

xJasonShane merged 1 commit into
mainfrom
test/fix-hash-pool-preempt-flake

Conversation

@xJasonShane

Copy link
Copy Markdown
Contributor

Summary

  • OPT-3 抢占测试的被抢占任务 bg-a 由 4 字节改为 64MB:抢占依赖 worker 在块边界收到 abort 消息,文件过小时 worker 可能在 abort 派发前完成哈希,导致 promise 正常 resolve 而非抛 PreemptedError
  • Node 22 CI 已两次复现该失败(PR build(deps-dev): bump electron-builder from 26.15.3 to 26.18.0 #35 及重跑),与依赖更新无关
  • 修复方式与同文件并行性测试(par-a 用 64MB)保持一致

Test plan

  • 本地 npx vitest run tests/hash-pool.test.js 13/13 通过
  • CI Node 22 / Node 24 通过

被抢占任务 bg-a 原为 4 字节极小文件,CI 低负载下 worker 可能在 abort 消息派发前就完成哈希,导致 promise 正常 resolve 而非抛出 PreemptedError(Node 22 CI 已两次复现)。改为 64MB 与同文件并行性测试保持一致,确保抢占必然在块边界生效。
@xJasonShane
xJasonShane merged commit c552431 into main Nov 5, 2026
3 checks passed
@xJasonShane
xJasonShane deleted the test/fix-hash-pool-preempt-flake branch November 9, 2026 10:17
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.

1 participant