|
@@ -143,13 +143,6 @@ func (hb *healthBalancer) updateUnhealthy(timeout time.Duration) {
|
|
|
case <-time.After(timeout):
|
|
case <-time.After(timeout):
|
|
|
hb.mu.Lock()
|
|
hb.mu.Lock()
|
|
|
for k, v := range hb.unhealthy {
|
|
for k, v := range hb.unhealthy {
|
|
|
- if _, ok := hb.hostPort2ep[k]; !ok {
|
|
|
|
|
- delete(hb.unhealthy, k)
|
|
|
|
|
- if logger.V(4) {
|
|
|
|
|
- logger.Infof("clientv3/health-balancer: removes stale host:port %q from unhealthy", k)
|
|
|
|
|
- }
|
|
|
|
|
- continue
|
|
|
|
|
- }
|
|
|
|
|
if time.Since(v) > timeout {
|
|
if time.Since(v) > timeout {
|
|
|
delete(hb.unhealthy, k)
|
|
delete(hb.unhealthy, k)
|
|
|
if logger.V(4) {
|
|
if logger.V(4) {
|
|
@@ -187,11 +180,13 @@ func (hb *healthBalancer) liveAddrs() []grpc.Address {
|
|
|
|
|
|
|
|
func (hb *healthBalancer) hostPortError(hostPort string, err error) {
|
|
func (hb *healthBalancer) hostPortError(hostPort string, err error) {
|
|
|
hb.mu.Lock()
|
|
hb.mu.Lock()
|
|
|
- hb.unhealthy[hostPort] = time.Now()
|
|
|
|
|
- hb.mu.Unlock()
|
|
|
|
|
- if logger.V(4) {
|
|
|
|
|
- logger.Infof("clientv3/health-balancer: marking %q as unhealthy (%q)", hostPort, err.Error())
|
|
|
|
|
|
|
+ if _, ok := hb.hostPort2ep[hostPort]; ok {
|
|
|
|
|
+ hb.unhealthy[hostPort] = time.Now()
|
|
|
|
|
+ if logger.V(4) {
|
|
|
|
|
+ logger.Infof("clientv3/health-balancer: marking %q as unhealthy (%q)", hostPort, err.Error())
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ hb.mu.Unlock()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (hb *healthBalancer) mayPin(addr grpc.Address) bool {
|
|
func (hb *healthBalancer) mayPin(addr grpc.Address) bool {
|