ops: Signal disk-tier attach pending vs ready
CI / vulncheck (pull_request) Successful in 14s
CI / check-and-test (pull_request) Successful in 40s

Large disk caches can look memory-only/broken during async DiskFS attach.
Expose disk_tier_ready in /metrics, pending/ready logs for disk-only and
mixed modes, and X-SteamCache-Disk-Tier on /lancache-heartbeat. GetMetrics
skips blocking disk.Size() while attach is pending so /metrics stays usable.

Closes #33
This commit is contained in:
2026-09-07 16:58:13 +00:00
parent c43bfba568
commit 12ea3ee4f6
5 changed files with 134 additions and 4 deletions
+9
View File
@@ -56,6 +56,15 @@ func (sc *SteamCache) handleSpecialEndpoints(w http.ResponseWriter, r *http.Requ
logger.Logger.Debug().
Str("client_ip", clientIP).
Msg("LanCache heartbeat request")
diskTier := "disabled"
if sc.disk != nil {
if sc.metrics.GetDiskTierReady() == 1 {
diskTier = "ready"
} else {
diskTier = "pending"
}
}
w.Header().Add("X-SteamCache-Disk-Tier", diskTier)
w.Header().Add("X-LanCache-Processed-By", "SteamCache2")
w.WriteHeader(http.StatusNoContent)
_, _ = w.Write(nil) // client write error ignored (heartbeat path; nil write is no-op)