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.

perf: Cache err.Error() in storage timeout error handling

rcourtman0bc58f678ec4
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index f944be9418..05bb3a2eb6 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -6968,7 +6968,8 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName
}
// Check if it's a timeout error
- if strings.Contains(err.Error(), "timeout") || strings.Contains(err.Error(), "deadline exceeded") {
+ errStr := err.Error()
+ if strings.Contains(errStr, "timeout") || strings.Contains(errStr, "deadline exceeded") {
if attempt == 1 {
log.Warn().
Str("node", node.Node).
diff --git a/internal/monitoring/monitor_polling.go b/internal/monitoring/monitor_polling.go
index 9828cbae6a..51f2b22c4a 100644
--- a/internal/monitoring/monitor_polling.go
+++ b/internal/monitoring/monitor_polling.go
@@ -1231,7 +1231,8 @@ func (m *Monitor) pollStorageWithNodes(ctx context.Context, instanceName string,
}
if err != nil {
// Handle timeout gracefully - unavailable storage (e.g., NFS mounts) can cause this
- if strings.Contains(err.Error(), "timeout") || strings.Contains(err.Error(), "deadline exceeded") {
+ errStr := err.Error()
+ if strings.Contains(errStr, "timeout") || strings.Contains(errStr, "deadline exceeded") {
log.Warn().
Str("node", n.Node).
Str("instance", instanceName).