wire configured quota limits into routing

This commit is contained in:
kami
2026-07-26 20:34:38 +04:00
parent 6e4df6d2ff
commit 17e7aef871
3 changed files with 12 additions and 0 deletions
+9
View File
@@ -42,6 +42,15 @@ func main() {
log.Fatalf("load orchestra config: %v", err)
}
rt = &router.Router{Store: s, Registry: rr, Reachability: registry.TCPReachability{}, Timeout: time.Second, Retry: router.RetryPolicy{MaxAttempts: 3, Backoff: time.Minute}}
limits := map[string]float64{}
for _, h := range rr.Herdrs() {
if h.QuotaLimit > 0 {
limits[h.ID] = h.QuotaLimit
}
}
if len(limits) > 0 {
rt.Availability = router.QuotaAvailability{Store: s, Limits: limits, Window: 7 * 24 * time.Hour}
}
if repo, root := os.Getenv("ORCHESTRA_REPO"), os.Getenv("ORCHESTRA_WORKTREE_ROOT"); repo != "" && root != "" {
adapters := map[string]herdr.Adapter{}
for _, h := range rr.Herdrs() {