Policy Rate Limiter¶
PolicyRateLimiter applies handler-level rate limits by mapping packet metadata onto shared token-bucket policies.
Source mapping¶
src/Nalix.Network/Throttling/PolicyRateLimiter.cs
What it does¶
- reads
PacketRateLimitAttribute-style policies - rounds requested RPS and burst values into shared tiers
- reuses token-bucket limiters across similar policies
- evicts stale policies over time
Basic usage¶
[PacketRateLimit(8, burst: 2.5)]
public async Task HandleChat(ChatPacket packet, IConnection connection) { }
At runtime:
Why it exists¶
It avoids creating a fully separate limiter for every slightly different handler policy, which keeps memory and cleanup behavior under control.
Diagnostics¶
GenerateReport() includes:
- active policy count
- policy tiers in use
- recent usage information