Stabilize AI provider health checks
All checks were successful
CI / test (push) Successful in 15s
Build and Deploy / build-and-deploy (push) Successful in 25s

This commit is contained in:
Grendgi
2026-06-08 16:23:50 +03:00
parent 039bcdb2b2
commit 04e463d03f
2 changed files with 70 additions and 18 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"strings"
"sync"
"time"
"ai-service/internal/config"
@@ -16,12 +17,14 @@ import (
)
type Server struct {
store *store.Store
cfg config.Config
store *store.Store
cfg config.Config
providerMu sync.Mutex
providerOKs map[string]providerHealthSnapshot
}
func NewServer(store *store.Store, cfg config.Config) http.Handler {
return &Server{store: store, cfg: cfg}
return &Server{store: store, cfg: cfg, providerOKs: make(map[string]providerHealthSnapshot)}
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {