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

Method buildFallback

internal/server/server.go:627–647  ·  view source on GitHub ↗
(primary string, health map[string]bool)

Source from the content-addressed store, hash-verified

625}
626
627func (s *Server) buildFallback(primary string, health map[string]bool) []types.RouteDecision {
628 out := make([]types.RouteDecision, 0)
629 for _, rule := range s.cfg.Reliability.FallbackRules {
630 if rule.FromBackend != primary {
631 continue
632 }
633 backendCfg, ok := s.cfg.BackendByName(rule.FallbackTo)
634 if !ok {
635 continue
636 }
637 if !router.BackendHealthOK(health, backendCfg.Name) {
638 continue
639 }
640 out = append(out, types.RouteDecision{
641 BackendName: backendCfg.Name,
642 Reason: "fallback-from-" + primary,
643 EstimatedCost: backendCfg.Cost.Unit,
644 })
645 }
646 return out
647}
648
649func fallbackReason(triggered bool) string {
650 if triggered {

Callers

nothing calls this directly

Calls 2

BackendHealthOKFunction · 0.92
BackendByNameMethod · 0.80

Tested by

no test coverage detected