Work Intent: Fix state file watcher detachment by enabling polling on emhttp state files (#1788)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 32/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend
调研方向
Do not start until a core developer removes the unapproved label. Once approved, read the file watcher setup in api/src/store/watch/state-watch.ts and the command client in api/src/core/utils/clients/emcmd.ts, then reproduce the stale var.ini state after an atomic replacement. Done means array state and parity check status stay current across replacements, with regression tests added.
由索引模型根据 Issue 内容生成。
描述
Overview
Resolves #1788 and eliminates desynchronization of array and parity check states in the GraphQL API.
In Unraid OS, emhttpd maintains live status files (such as /var/local/emhttp/var.ini) by writing to temporary files (*.ini.new) and atomically renaming them over the active state file. When unraid-api watches var.ini via inotify (usePolling: false), atomic file replacements detach the inotify watch from the unlinked inode. Once detached, the in-memory Redux store permanently ceases updating until the API daemon is restarted, causing array.state and array.parityCheckStatus queries to return stale snapshots indefinitely.
Technical Approach
- In
api/src/store/watch/state-watch.ts, configure Chokidar to use path-based polling (usePolling: true) across emhttp state files (1s interval for dynamic files likevar.ini, 10s interval for list collections likedisksandshares). - In
api/src/core/utils/clients/emcmd.ts, trigger an immediate reload ofStateFileKey.varupon successful command execution so callers reading state immediately receive the new state without polling latency. - Add regression tests validating state reload consistency across atomic file replacements.
Scope
- API
- Plugin
- Web UI
- Build/Deploy Process
- Documentation
Timeline & Impact
- Estimated time needed: 1–2 days
- Potential impacts: Eliminates stale array and parity states in the GraphQL API; minimal CPU overhead (single-path
statpolling at 1s interval).
Pre-submission Checklist
- I have searched for similar work/issues
- I understand this needs approval before starting
- I am willing to make adjustments based on feedback
- 主要语言
- TypeScript
- 星标
- 123
- 派生
- 25
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
unraid/api 的其他 Issue
-
Temperature metrics: lm-sensors voltages, fan speeds and power are reported as temperatures (°C)未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
flash { guid } always fails: resolver no longer returns guid but the schema marks it non-nullable未关闭
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
yavorsky/unbuilt.app#65 ·
-
CVE security
难度 2/5 1-3 小时 新手友好度 68/100
mckinsey/agents-at-scale-ark#4091 · 1 条评论 ·
维护者通常 1 天内回复
-
factory:subtask
难度 1/5 1 小时以内 新手友好度 94/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
NUS-Project-SaBai/project-sabai#386 ·
维护者通常 3 天内回复
-
android needs clarification
难度 2/5 1-3 小时 新手友好度 72/100
super-productivity/super-productivity#12105 · 3 条评论 ·
维护者通常 1 天内回复