p3: tavily parse errors degrade; retry DNS on search
A 200 with a bad Tavily body is tavily: error, not an empty success that would cache for the hour. Upstream clients stay in the source list if DNS is down at boot and retry the pin on Search; /healthz lists them as unresolved until a pin lands.
This commit is contained in:
@@ -20,7 +20,7 @@ type Engine struct {
|
||||
CacheTTL time.Duration
|
||||
Embedder Embedder
|
||||
Log *slog.Logger
|
||||
Degraded []string // healthz: "search.brave_llm: missing key"
|
||||
Degraded []string // static: missing keys
|
||||
TavilyCap int
|
||||
Now func() time.Time
|
||||
|
||||
@@ -46,6 +46,27 @@ type RunResult struct {
|
||||
Attempted []string
|
||||
}
|
||||
|
||||
type readySrc interface {
|
||||
Name() string
|
||||
Ready() bool
|
||||
}
|
||||
|
||||
// Health is missing keys plus sources that still have no pin.
|
||||
func (e *Engine) Health() []string {
|
||||
if e == nil {
|
||||
return nil
|
||||
}
|
||||
out := append([]string(nil), e.Degraded...)
|
||||
for _, s := range e.Sources {
|
||||
r, ok := s.(readySrc)
|
||||
if !ok || r.Ready() {
|
||||
continue
|
||||
}
|
||||
out = append(out, "search."+r.Name()+": unresolved")
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (e *Engine) now() time.Time {
|
||||
if e != nil && e.Now != nil {
|
||||
return e.Now()
|
||||
|
||||
Reference in New Issue
Block a user