MCPcopy Index your code
hub / github.com/InferCore/InferCore / probeBackendHealth

Method probeBackendHealth

internal/server/server.go:316–330  ·  view source on GitHub ↗

probeBackendHealth runs Health with per-backend timeouts independent of the caller context (e.g. short /infer request_timeout_ms must not cancel health probes).

(perCheck time.Duration)

Source from the content-addressed store, hash-verified

314// probeBackendHealth runs Health with per-backend timeouts independent of the caller context
315// (e.g. short /infer request_timeout_ms must not cancel health probes).
316func (s *Server) probeBackendHealth(perCheck time.Duration) map[string]bool {
317 out := make(map[string]bool, len(s.cfg.Backends))
318 for _, b := range s.cfg.Backends {
319 adapter, ok := s.adapters[b.Name]
320 if !ok {
321 out[b.Name] = false
322 continue
323 }
324 hctx, cancel := context.WithTimeout(context.Background(), perCheck)
325 err := adapter.Health(hctx)
326 cancel()
327 out[b.Name] = err == nil
328 }
329 return out
330}
331
332func (s *Server) metrics(w http.ResponseWriter, r *http.Request) {
333 if !s.cfg.Telemetry.MetricsEnabled {

Callers 1

cachedBackendHealthMethod · 0.95

Calls 1

HealthMethod · 0.65

Tested by

no test coverage detected