Feature: Expose parity check estimated remaining time and elapsed seconds in GraphQL schema

未关闭
#2,135 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
graphql, typescript
领域
api, backend

调研方向

Start with getParityCheckStatus in api/src/core/utils/clients/emcmd.ts, which already computes speed, progress and duration from the var data, and check how the ParityCheck ObjectType in api/src/unraid-api/graph/resolvers/array/array.model.ts maps those fields. Work out the remaining-time formula from mdResyncSize, mdResyncPos, mdResyncDb and mdResyncDt and handle the zero or missing cases. Done means estimatedRemaining and elapsed appear as nullable seconds in the GraphQL schema and resolve correctly while a check is running.

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem?

When a parity check or disk rebuild/sync is in progress on Unraid OS, client integrations (such as Home Assistant, Unraid Connect, and third-party dashboards) need to display elapsed time and estimated time to completion.

Currently, the Unraid WebGUI (Dynamix) calculates these values locally on-the-fly from /var/local/emhttp/var.ini:

  • Elapsed time: now - sbSynced
  • Estimated finish: (mdResyncSize - mdResyncPos) / (mdResyncDb / mdResyncDt)

However, in unraid/api, while getParityCheckStatus(varData) already computes speed, progress, and duration (now - sbSynced), it does not compute or expose an estimated / estimatedRemaining field in the GraphQL schema, and duration is not aliased or documented as elapsed. As a result, API clients are unable to display accurate completion estimates without reverse-engineering low-level driver variables.

Describe the solution you'd like

  1. In api/src/core/utils/clients/emcmd.ts (or getParityCheckStatus):
    • Add estimatedRemaining: number | undefined (remaining time in seconds), calculated from mdResyncSize, mdResyncPos, mdResyncDb, and mdResyncDt.
    • Expose elapsed: number | undefined alongside (or aliased to) duration.
  2. Update the ParityCheck GraphQL ObjectType in api/src/unraid-api/graph/resolvers/array/array.model.ts to include:
    • estimatedRemaining: Int (nullable, seconds remaining)
    • elapsed: Int (nullable, elapsed seconds)

Describe alternatives you've considered

Clients could attempt to query raw state or estimate completion client-side using progress and speed, but this introduces clock skew and inconsistent calculations between the WebGUI, Unraid Connect, and external integrations. Computing this server-side ensures a single source of truth across all consumers.

Environment (if relevant)

Unraid OS Version: 7.0.0+ / 7.2.0+

Pre-submission Checklist

  • I have searched existing issues to ensure this feature hasn't already been requested
  • This is not an Unraid Connect related feature
  • I have provided clear examples or use cases for the feature
主要语言
TypeScript
星标
123
派生
25
平均合并
2 天 16 小时
30 天内合并 PR
9

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

unraid/api 的其他 Issue

查看 unraid/api 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。