You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add TaskQueueRateLimitFractionProvider interface to scale task queue rate limits (#10827)
## What changed?
Introduces a `TaskQueueRateLimitFractionProvider` interface in the
matching service that applies a fractional multiplier to the task queue
rate limit. The default implementation returns `1.0` (no change in
behavior). The interface can be overridden via `fx.Decorate` to supply a
custom fraction per namespace and task queue.
The provider is stored on `*Config` and bound as a closure
(`RateLimitFraction func() float64`) inside `newTaskQueueConfig`. The
`rateLimitManager` calls it directly in
`computeEffectiveRPSAndSourceLocked`. The `[0.0, 1.0]` range is enforced
at the provider layer via `NewTaskQueueRateLimitFractionProvider`.
Note: `adminNsRate` / `adminTqRate` are per-partition system caps and
are intentionally not scaled by the fraction.
## Why?
Provides an extension point for deployments that need to scale task
queue rate limits by a fractional value per namespace/task queue,
without changing rate limit logic.
## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit tests for clamping behavior
## Potential risks
The fraction defaults to `1.0` so existing behavior is unchanged. A
misconfigured implementation returning `0.0` would effectively pause
task dispatch — operators overriding this interface should ensure
correctness of the returned fraction.
---------
Signed-off-by: Sandeep Balaji <sandeep.balaji@temporal.io>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments