feat: rotate sessions on occupancy threshold

This commit is contained in:
kami
2026-07-26 20:07:34 +04:00
parent dc3cebebf8
commit 5a360c051c
3 changed files with 69 additions and 4 deletions
+9
View File
@@ -49,6 +49,15 @@ func main() {
}
coordinator := &orchestrator.Coordinator{Store: s, Worktrees: orchestrator.GitWorktrees{Root: root, Repo: repo}, Adapters: orchestrator.AdapterFactory{Herdrs: adapters}}
rt.OnLease = func(e domain.Event) error { return coordinator.Start(context.Background(), e) }
hard := 0.75
if v, parseErr := strconv.ParseFloat(os.Getenv("ORCHESTRA_OCCUPANCY_HARD"), 64); parseErr == nil && v > 0 && v < 1 {
hard = v
}
go func() {
if monitorErr := coordinator.Monitor(context.Background(), hard, 30*time.Second); monitorErr != nil {
log.Printf("orchestrator monitor: %v", monitorErr)
}
}()
}
}
mux := http.NewServeMux()