Stabilize AI provider health checks
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user