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

Cache err.Error() result in two locations:
- monitor.go: storage query retry logic (2x calls to 1)
- monitor_polling.go: storage timeout handling (2x calls to 1)
This commit is contained in:
rcourtman 2025-12-02 15:39:37 +00:00
parent 5d2eca3660
commit 6a29e20b5e
2 changed files with 4 additions and 2 deletions

View file

@ -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).

View file

@ -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).