mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:18:31 +02:00
refactor: minor styling fixes; deadcode cleanup and correct log level
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user