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

Aperta
#2,135 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
graphql, typescript
Ambito
api, backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
TypeScript
Stelle
123
Fork
25
Merge medio
2g 16h
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di unraid/api

Tutte le issue di unraid/api

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.