Problem
During a single reconciliation cycle (e.g., thv list or thv status), the fileStatusManager reads the same RunConfig file from disk multiple times per workload via runConfigStore.GetReader():
isRemoteWorkload() — reads remote_url field
isOwnedByActiveRuntime() — reads runtime_name field
migrateRuntimeName() — reads all fields (for write-back on legacy workloads)
Each call opens the file, parses JSON, extracts one or two fields, then closes. For a user with N workloads, thv list performs up to 3N file reads where N would suffice.
References
isRemoteWorkload: pkg/workloads/statuses/file_status.go (~line 169)
isOwnedByActiveRuntime: pkg/workloads/statuses/file_status.go (~line 82)
migrateRuntimeName: pkg/workloads/statuses/file_status.go (~line 114)
- Related import cycle TODO:
pkg/workloads/statuses/file_status.go (~line 73)
Introduced by #4434.
Problem
During a single reconciliation cycle (e.g.,
thv listorthv status), thefileStatusManagerreads the same RunConfig file from disk multiple times per workload viarunConfigStore.GetReader():isRemoteWorkload()— readsremote_urlfieldisOwnedByActiveRuntime()— readsruntime_namefieldmigrateRuntimeName()— reads all fields (for write-back on legacy workloads)Each call opens the file, parses JSON, extracts one or two fields, then closes. For a user with N workloads,
thv listperforms up to 3N file reads where N would suffice.References
isRemoteWorkload:pkg/workloads/statuses/file_status.go(~line 169)isOwnedByActiveRuntime:pkg/workloads/statuses/file_status.go(~line 82)migrateRuntimeName:pkg/workloads/statuses/file_status.go(~line 114)pkg/workloads/statuses/file_status.go(~line 73)Introduced by #4434.