ops: Signal disk-tier attach pending vs ready
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user