Wire wake and identity into crossbar; v2 smoke and README
Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
@@ -152,6 +152,30 @@ func (p *Handler) writeError(w http.ResponseWriter, status int, msg string) {
|
||||
_ = json.NewEncoder(w).Encode(map[string]string{"error": msg})
|
||||
}
|
||||
|
||||
// writeNoHealthyHost answers the 503 when no candidate woke. The body names the
|
||||
// hosts that were asked to wake (an empty list, never null), and the row
|
||||
// records the miss.
|
||||
func (p *Handler) writeNoHealthyHost(w http.ResponseWriter, route, model, fp string, started time.Time, tried []string) {
|
||||
if tried == nil {
|
||||
tried = []string{}
|
||||
}
|
||||
p.writeRecord(store.Request{
|
||||
Route: route,
|
||||
FP: fp,
|
||||
Model: model,
|
||||
Started: started,
|
||||
TotalMs: time.Since(started).Milliseconds(),
|
||||
Status: http.StatusServiceUnavailable,
|
||||
Err: "no healthy host",
|
||||
})
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{
|
||||
"error": "no healthy host",
|
||||
"woke": tried,
|
||||
})
|
||||
}
|
||||
|
||||
// writeRecord writes one accounting row, logging (never returning) a recorder error.
|
||||
func (p *Handler) writeRecord(req store.Request) {
|
||||
if p.rec == nil {
|
||||
|
||||
Reference in New Issue
Block a user