only force update picker when cache is used (sub-balancer is round-robin) (#2843)
This commit is contained in:
@ -95,14 +95,6 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) {
|
|||||||
//
|
//
|
||||||
// Caller must hold lb.mu.
|
// Caller must hold lb.mu.
|
||||||
func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback bool, pickFirst bool) {
|
func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback bool, pickFirst bool) {
|
||||||
defer func() {
|
|
||||||
// Regenerate and update picker after refreshing subconns because with
|
|
||||||
// cache, even if SubConn was newed/removed, there might be no state
|
|
||||||
// changes (the subconn will be kept in cache, not actually
|
|
||||||
// newed/removed).
|
|
||||||
lb.updateStateAndPicker(true, true)
|
|
||||||
}()
|
|
||||||
|
|
||||||
lb.inFallback = fallback
|
lb.inFallback = fallback
|
||||||
|
|
||||||
opts := balancer.NewSubConnOptions{}
|
opts := balancer.NewSubConnOptions{}
|
||||||
@ -184,6 +176,12 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback
|
|||||||
// The entry will be deleted in HandleSubConnStateChange.
|
// The entry will be deleted in HandleSubConnStateChange.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regenerate and update picker after refreshing subconns because with
|
||||||
|
// cache, even if SubConn was newed/removed, there might be no state
|
||||||
|
// changes (the subconn will be kept in cache, not actually
|
||||||
|
// newed/removed).
|
||||||
|
lb.updateStateAndPicker(true, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lb *lbBalancer) readServerList(s *balanceLoadClientStream) error {
|
func (lb *lbBalancer) readServerList(s *balanceLoadClientStream) error {
|
||||||
|
Reference in New Issue
Block a user