Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

refactor: Remove unreachable dead code branches

rcourtmanb6ae5d5e246a
diff --git a/internal/errors/errors.go b/internal/errors/errors.go
index d336b050f1..60b56b8b5b 100644
--- a/internal/errors/errors.go
+++ b/internal/errors/errors.go
@@ -116,14 +116,13 @@ func isRetryable(errorType ErrorType, err error) bool {
return true
case ErrorTypeAuth, ErrorTypeValidation, ErrorTypeNotFound:
return false
- case ErrorTypeInternal, ErrorTypeAPI:
+ default: // ErrorTypeInternal, ErrorTypeAPI
// Check the underlying error
if err != nil {
return !errors.Is(err, ErrInvalidInput) && !errors.Is(err, ErrForbidden)
}
return true
}
- return false
}
// Helper functions
diff --git a/internal/monitoring/scheduler.go b/internal/monitoring/scheduler.go
index 129c0080b3..16d4b466e9 100644
--- a/internal/monitoring/scheduler.go
+++ b/internal/monitoring/scheduler.go
@@ -305,15 +305,9 @@ func (a *adaptiveIntervalSelector) SelectInterval(req IntervalRequest) time.Dura
score := clampFloat(req.StalenessScore, 0, 1)
span := float64(max - min)
+ // target is mathematically in [min, max] since score ∈ [0,1] and span >= 0
target := time.Duration(float64(min) + span*(1-score))
- if target < min {
- target = min
- }
- if target > max {
- target = max
- }
-
if req.ErrorCount > 0 {
penalty := 1 + a.errorPenalty*float64(req.ErrorCount)
if penalty > 0 {