fix: resolve 'no healthy nodes available' storage error (addresses #405)

- Changed cluster client initialization to be optimistic (assume healthy)
- Nodes now start as healthy and are marked unhealthy only on actual failures
- This prevents the issue where all nodes were marked unhealthy during init
- Storage operations can now proceed even if initial health checks fail
- Allows recovery from temporary network or auth issues during startup
This commit is contained in:
Pulse Monitor
2025-09-03 21:53:46 +00:00
parent 6e1f8ca736
commit 151228ce28
+4 -2
View File
@@ -36,12 +36,14 @@ func NewClusterClient(name string, config ClientConfig, endpoints []string) *Clu
}
// Initialize all endpoints as unknown (will be tested on first use)
// Don't assume they're healthy until proven
// Start optimistically - assume healthy until proven otherwise
// This allows operations to be attempted even if initial health check fails
for _, endpoint := range endpoints {
cc.nodeHealth[endpoint] = false // Start pessimistic, will test immediately
cc.nodeHealth[endpoint] = true // Start optimistic, will be marked unhealthy if operations fail
}
// Do a quick parallel health check on initialization (synchronous to avoid race)
// This will mark unhealthy nodes but won't prevent trying them later
cc.initialHealthCheck()
return cc