perf(shared-state): batch calibrator counters with the usage write

Each served request spawned a second async write for the calibrator
counters. They now ride the batch accountWith already sends, and only
when shared state is on and a store is configured.
This commit is contained in:
2026-11-26 04:12:38 +00:00
parent 383d477778
commit 367f3b60ff
6 changed files with 98 additions and 21 deletions
+1 -3
View File
@@ -25,9 +25,7 @@ func (g *Gateway) wireSharedState(cfg *Config) {
}
g.shareDecisionBreakers(ids)
if g.tokenCalib != nil && g.limiter != nil {
g.tokenCalib.share(
func(entries []counterIncr) { g.limiter.countAsync(entries) },
func() time.Time { return g.limiter.now() })
g.tokenCalib.share(func() time.Time { return g.limiter.now() })
}
}