fallbackToBackendsAfter blocks for fallbackTimeout and falls back to use resolved backends (backends received from resolver, not from remote balancer) if no connection to remote balancers was successful.
(fallbackTimeout time.Duration)
| 402 | // resolved backends (backends received from resolver, not from remote balancer) |
| 403 | // if no connection to remote balancers was successful. |
| 404 | func (lb *lbBalancer) fallbackToBackendsAfter(fallbackTimeout time.Duration) { |
| 405 | timer := time.NewTimer(fallbackTimeout) |
| 406 | defer timer.Stop() |
| 407 | select { |
| 408 | case <-timer.C: |
| 409 | case <-lb.doneCh: |
| 410 | return |
| 411 | } |
| 412 | lb.mu.Lock() |
| 413 | if lb.inFallback || lb.serverListReceived { |
| 414 | lb.mu.Unlock() |
| 415 | return |
| 416 | } |
| 417 | // Enter fallback. |
| 418 | lb.refreshSubConns(lb.resolvedBackendAddrs, true, lb.usePickFirst) |
| 419 | lb.mu.Unlock() |
| 420 | } |
| 421 | |
| 422 | func (lb *lbBalancer) handleServiceConfig(gc *grpclbServiceConfig) { |
| 423 | lb.mu.Lock() |
no test coverage detected