8000 test(reports): wait for post-rebuild refreshes before checking increments by InfinityPacer · Pull Request #40 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content

test(reports): wait for post-rebuild refreshes before checking increments - #40

Merged
InfinityPacer merged 1 commit into
mainfrom
test/view-service-settle-refresh
Oct 14, 2026
Merged

InfinityPacer merged 1 commit into
mainfrom
test/view-service-settle-refresh

Conversation

@InfinityPacer
Copy link
Copy Markdown
Owner

问题

tests/view-service.test.ts 中「a price change rebuilds in the background…」偶发失败(近 100 次 CI 中 2 次,2026-09-28 的 CI 与 0.9.11 的 Release),都停在最后一步:写入第二条用量后报表计数一直为 1。

价格重建完成后,缓存里的查询按最近使用顺序逐个刷新。测试只等到了分页查询刷新完毕,默认查询可能仍在刷新。此时写入增量并读取,读取遇到进行中的刷新不会再发起刷新,而进行中的刷新可能已在写入前读过数据库;之后的观察读取(refresh=false)也不触发刷新,所以等待多久都停在 1。失败日志中重建在 29.527 秒完成,随后 2 秒内没有任何刷新,与此吻合。

产品侧没有丢数:页面的定时刷新和下一次读取都会补上,最多晚一个刷新周期。

改动

写入增量前,等默认查询也换成新价格版本且不在刷新中,再验证增量。断言没有放宽。

验证

  • bun test tests 全部通过;该文件连续运行 10 次无失败。
  • 本地(含 CPU 满载 30 次)未能复现原始失败,根因依据 CI 日志时间线与刷新逻辑推断。

🤖 Generated with Claude Code

…ents

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@InfinityPacer
InfinityPacer merged commit 989aa49 into main Oct 14, 2026
2 checks passed
@InfinityPacer
InfinityPacer deleted the test/view-service-settle-refresh branch October 14, 2026 11:54
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

0