2
0

Fix formatting (gofmt, remove BOM)
All checks were successful
CI / build-and-test (push) Successful in 1m13s
Release / build (amd64, darwin) (push) Successful in 57s
Release / build (amd64, linux) (push) Successful in 55s
Release / build (amd64, windows) (push) Successful in 54s
Release / build (arm64, darwin) (push) Successful in 53s
Release / build (arm64, linux) (push) Successful in 52s
Release / release (push) Successful in 19s

This commit is contained in:
GitCaddy
2026-01-15 13:09:06 +00:00
parent 3addd66efa
commit d955727863
2 changed files with 6 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2026 MarketAlly. All rights reserved.
// Copyright 2026 MarketAlly. All rights reserved.
// SPDX-License-Identifier: MIT
package cleanup

View File

@@ -1,4 +1,4 @@
// Copyright 2026 MarketAlly. All rights reserved.
// Copyright 2026 MarketAlly. All rights reserved.
// SPDX-License-Identifier: MIT
package envcheck
@@ -915,7 +915,7 @@ func detectCPULoad() *CPUInfo {
// Check if running in a container (LXC/Docker)
// Containers share /proc/loadavg with host, giving inaccurate readings
inContainer := isInContainer()
if inContainer {
// Try to get CPU usage from cgroups (more accurate for containers)
if cgroupCPU := getContainerCPUUsage(); cgroupCPU >= 0 {
@@ -928,7 +928,7 @@ func detectCPULoad() *CPUInfo {
info.LoadAvg1m = 0
return info
}
// Not in container - use traditional /proc/loadavg
data, err := os.ReadFile("/proc/loadavg")
if err != nil {
@@ -1041,7 +1041,7 @@ func getContainerCPUUsage() float64 {
}
}
}
// Try reading /proc/stat for this process's CPU usage
if data, err := os.ReadFile("/proc/self/stat"); err == nil {
fields := strings.Fields(string(data))
@@ -1051,7 +1051,7 @@ func getContainerCPUUsage() float64 {
// For containers, we'll report 0 rather than misleading host data
}
}
return -1 // Unable to determine - caller should handle
}