(ctx *routing.LBContext)
| 164 | } |
| 165 | |
| 166 | func computeLoadAverage(ctx *routing.LBContext) float64 { |
| 167 | sum := 1.0 // add 1 to include the request that just arrived |
| 168 | endpoints := ctx.LBEndpoints |
| 169 | for _, v := range endpoints { |
| 170 | sum += float64(v.Metrics.InflightRequests()) |
| 171 | } |
| 172 | return sum / float64(len(endpoints)) |
| 173 | } |
| 174 | |
| 175 | // Returns index of endpoint with closest hash to key's hash, which is also below the target load |
| 176 | // skipEndpoint function is used to skip endpoints we don't want, for example, fading endpoints |
no test coverage detected
searching dependent graphs…