Skip to content

Commit

Permalink
only force update picker when cache is used (sub-balancer is round-ro…
Browse files Browse the repository at this point in the history
…bin)
  • Loading branch information
menghanl committed May 30, 2019
1 parent 82fdf27 commit af89aee
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions balancer/grpclb/grpclb_remote_balancer.go
Expand Up @@ -95,14 +95,6 @@ func (lb *lbBalancer) processServerList(l *lbpb.ServerList) {
//
// Caller must hold lb.mu.
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

opts := balancer.NewSubConnOptions{}
Expand Down Expand Up @@ -184,6 +176,12 @@ func (lb *lbBalancer) refreshSubConns(backendAddrs []resolver.Address, fallback
// 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 {
Expand Down

0 comments on commit af89aee

Please sign in to comment.