(info balancer.PickInfo)
| 199 | } |
| 200 | |
| 201 | func (p *orcaPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { |
| 202 | res, err := p.childPicker.Pick(info) |
| 203 | if err != nil { |
| 204 | return res, err |
| 205 | } |
| 206 | |
| 207 | p.oobState.mu.Lock() |
| 208 | lr := p.oobState.reports[res.SubConn] |
| 209 | p.oobState.mu.Unlock() |
| 210 | |
| 211 | origDone := res.Done |
| 212 | res.Done = func(di balancer.DoneInfo) { |
| 213 | perRPCLR, _ := di.ServerLoad.(*v3orcapb.OrcaLoadReport) |
| 214 | if perRPCLR != nil && (perRPCLR.CpuUtilization != 0 || perRPCLR.MemUtilization != 0 || len(perRPCLR.Utilization) > 0 || len(perRPCLR.RequestCost) > 0) { |
| 215 | setContextCMR(info.Ctx, perRPCLR) |
| 216 | } else if lr != nil { |
| 217 | setContextCMR(info.Ctx, lr) |
| 218 | } |
| 219 | if origDone != nil { |
| 220 | origDone(di) |
| 221 | } |
| 222 | } |
| 223 | return res, nil |
| 224 | } |
| 225 | |
| 226 | func setContextCMR(ctx context.Context, lr *v3orcapb.OrcaLoadReport) { |
| 227 | if r := orcaResultFromContext(ctx); r != nil { |
nothing calls this directly
no test coverage detected