feat: rotate sessions on occupancy threshold
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user