[RateLimiter] Allow overriding the key of a compound limiter's sub-limiters
A compound rate limiter forwards the same key to every sub-limiter. Mixing a per-user limiter with a global one in the same compound already works with a custom RateLimiterFactoryInterface implementation, but cannot be expressed from framework.rate_limiter configuration, where compound limiters are actually declared. - Add an optional $keys argument to CompoundRateLimiterFactory: a map of sub-limiter name to a key that always takes precedence over the one passed to create(). An unknown name in $keys makes create() throw instead of being silently ignored. - Add an optional "key" config option under framework.rate_limiter.<name>.limiters.*, wired to the above. A compound referencing an unknown sub-limiter name now throws with the offending name(s) instead of a generic message. - "limiters" keeps accepting a plain list of names: a map form lets individual entries set "key". The compound's IteratorArgument in the compiled container is now indexed by limiter name instead of position. Individual limiter definitions stay untouched and reusable outside of compounds. A fixed key is shared by every caller of the compound. CompoundLimiter::consume() draining a shared quota on a rejected consume is a pre-existing issue, left for a separate fix. CompoundLimiter::reset() clearing a shared sub-limiter's window along with the caller's own is a known limitation of this feature, to be documented.
N
Nicolas Jourdan committed
ff5b69d4c113b3e0e588586c3cb829741ccd22ac
Parent: 72eeb84
Committed by Nicolas Grekas <nicolas.grekas@gmail.com>
on 9/4/2026, 8:10:06 AM