refactor: extract magic numbers to named constants
Replace inline numeric literals with named constants across 14 files: server timeouts/rate limits, cluster thresholds/intervals, DB pool sizes, alert/dial timeouts, TUI uptime thresholds, node status thresholds, and state history limits.
This commit was merged in pull request #153.
This commit is contained in:
@@ -26,12 +26,18 @@ type ProbeConfig struct {
|
||||
AllowPrivateTargets bool
|
||||
}
|
||||
|
||||
const (
|
||||
probeMinInterval = 10
|
||||
probeDefaultInterval = 30
|
||||
probeAPITimeout = 10 * time.Second
|
||||
)
|
||||
|
||||
func RunProbe(ctx context.Context, cfg ProbeConfig) error {
|
||||
if cfg.Interval < 10 {
|
||||
cfg.Interval = 30
|
||||
if cfg.Interval < probeMinInterval {
|
||||
cfg.Interval = probeDefaultInterval
|
||||
}
|
||||
|
||||
apiClient := &http.Client{Timeout: 10 * time.Second}
|
||||
apiClient := &http.Client{Timeout: probeAPITimeout}
|
||||
dial := monitor.SafeDialContext(cfg.AllowPrivateTargets)
|
||||
strictClient := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
|
||||
Reference in New Issue
Block a user