| 445 | } |
| 446 | |
| 447 | func (p *picker) endpointWeights(recordMetrics bool) []float64 { |
| 448 | wp := make([]float64, len(p.weightedPickers)) |
| 449 | now := internal.TimeNow() |
| 450 | for i, wpi := range p.weightedPickers { |
| 451 | wp[i] = wpi.weightedEndpoint.weight(now, time.Duration(p.cfg.WeightExpirationPeriod), time.Duration(p.cfg.BlackoutPeriod), recordMetrics) |
| 452 | } |
| 453 | return wp |
| 454 | } |
| 455 | |
| 456 | func (p *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { |
| 457 | // Read the scheduler atomically. All scheduler operations are threadsafe, |