MCPcopy Create free account
hub / github.com/InferCore/InferCore / firstHealthyBackend

Method firstHealthyBackend

internal/router/rule_router.go:95–107  ·  view source on GitHub ↗
(state types.RuntimeState)

Source from the content-addressed store, hash-verified

93}
94
95func (r *RuleRouter) firstHealthyBackend(state types.RuntimeState) (types.RouteDecision, bool) {
96 for _, backend := range r.cfg.Backends {
97 if !backendSelectable(state, backend.Name) {
98 continue
99 }
100 return types.RouteDecision{
101 BackendName: backend.Name,
102 Reason: "healthy-fallback-order",
103 EstimatedCost: backend.Cost.Unit,
104 }, true
105 }
106 return types.RouteDecision{}, false
107}
108
109func (r *RuleRouter) optimizeByCost(tenant config.TenantConfig, req types.AIRequest, base types.RouteDecision, state types.RuntimeState) types.RouteDecision {
110 if r.costEngine == nil {

Callers 1

selectByRulesMethod · 0.95

Calls 1

backendSelectableFunction · 0.85

Tested by

no test coverage detected