refactor: minor styling fixes; deadcode cleanup and correct log level

This commit is contained in:
yusing
2026-02-15 20:01:36 +08:00
parent 35b8a60edb
commit 154149b06d
29 changed files with 88 additions and 67 deletions

View File

@@ -31,8 +31,10 @@ type Config struct {
client *Client
}
const ResourcePollInterval = 3 * time.Second
const SessionRefreshInterval = 1 * time.Minute
const (
ResourcePollInterval = 3 * time.Second
SessionRefreshInterval = 1 * time.Minute
)
// NodeStatsPollInterval controls how often node stats are streamed when streaming is enabled.
const NodeStatsPollInterval = time.Second
@@ -158,6 +160,7 @@ func (c *Config) refreshSessionLoop(ctx context.Context) {
backoff := time.Duration(min(math.Pow(2, float64(numRetries)), 10)) * time.Second
ticker.Reset(backoff)
} else {
numRetries = 0
ticker.Reset(SessionRefreshInterval)
}
}

View File

@@ -140,9 +140,6 @@ func formatIECBytes(b uint64) string {
// One decimal, trimming trailing ".0" to keep output compact (e.g. "10GiB").
s := fmt.Sprintf("%.1f", val)
s = strings.TrimSuffix(s, ".0")
if exp == 0 {
return s + "B"
}
return s + prefixes[exp] + "B"
}