fix(health-check): prevent unhandled rejection on timeout#1756
Conversation
…ing sendMessage
The health check responsePromise could reject (via setTimeout) while
sendMessage.invoke() was still pending. Since responsePromise wasn't
yet being awaited, this produced an unhandled promise rejection.
Add responsePromise.catch(() => {}) immediately after creation to mark
the rejection as handled. The actual error is still caught by the outer
try-catch via `await responsePromise`.
Fixes ELECTRON-P
Code Review:fix(health-check): prevent unhandled rejection on timeout (#1756)变更概述本 PR 修复 Sentry 高频错误 ELECTRON-P(105 次),根因是健康检查中 方案评估结论:✅ 方案合理
问题清单未发现阻塞性问题。以下为一个低优先级观察: 🔵 LOW — 测试中
|
| # | 严重级别 | 文件 | 问题 |
|---|---|---|---|
| 1 | 🔵 LOW | tests/unit/healthCheckTimeout.test.ts:22 |
process.on('unhandledRejection') 在 Vitest 环境可靠性存疑 |
结论
✅ 批准合并 — 修复方案正确、最小化,测试覆盖核心场景,CI 全部通过,无阻塞性问题。
本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
Summary
responsePromise.catch(() => {})to prevent unhandled rejection when health check timeout fires whilesendMessage.invoke()is still pendingawait responsePromiseSentry: ELECTRON-P (105 occurrences)
Closes #1755
Test plan
.catch()attached does not trigger unhandledRejection.catch()attached