MCPcopy
hub / github.com/grpc/grpc-go / endpointWeights

Method endpointWeights

balancer/weightedroundrobin/balancer.go:447–454  ·  view source on GitHub ↗
(recordMetrics bool)

Source from the content-addressed store, hash-verified

445}
446
447func (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
456func (p *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) {
457 // Read the scheduler atomically. All scheduler operations are threadsafe,

Callers 1

newSchedulerMethod · 0.95

Calls 1

weightMethod · 0.80

Tested by

no test coverage detected