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

Method start

balancer/weightedroundrobin/balancer.go:490–509  ·  view source on GitHub ↗
(stopPicker *grpcsync.Event)

Source from the content-addressed store, hash-verified

488}
489
490func (p *picker) start(stopPicker *grpcsync.Event) {
491 p.regenerateScheduler()
492 if len(p.weightedPickers) == 1 {
493 // No need to regenerate weights with only one backend.
494 return
495 }
496
497 go func() {
498 ticker := time.NewTicker(time.Duration(p.cfg.WeightUpdatePeriod))
499 defer ticker.Stop()
500 for {
501 select {
502 case <-stopPicker.Done():
503 return
504 case <-ticker.C:
505 p.regenerateScheduler()
506 }
507 }
508 }()
509}
510
511// endpointWeight is the weight for an endpoint. It tracks the SubConn that will
512// be picked for the endpoint, and other parameters relevant to computing the

Callers 1

UpdateStateMethod · 0.95

Calls 3

regenerateSchedulerMethod · 0.95
StopMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected