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:
parent
5d2eca3660
commit
6a29e20b5e
2 changed files with 4 additions and 2 deletions
|
|
@ -6968,7 +6968,8 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's a timeout error
|
// 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 {
|
if attempt == 1 {
|
||||||
log.Warn().
|
log.Warn().
|
||||||
Str("node", node.Node).
|
Str("node", node.Node).
|
||||||
|
|
|
||||||
|
|
@ -1231,7 +1231,8 @@ func (m *Monitor) pollStorageWithNodes(ctx context.Context, instanceName string,
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Handle timeout gracefully - unavailable storage (e.g., NFS mounts) can cause this
|
// 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().
|
log.Warn().
|
||||||
Str("node", n.Node).
|
Str("node", n.Node).
|
||||||
Str("instance", instanceName).
|
Str("instance", instanceName).
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue