Shared
TokenBucket
Per-player rate limiter. Used internally by App and each Port. Also available standalone for custom rate-limiting logic outside the request pipeline.
Import
-- Access via app.TokenBucket or create standalone
rate limit
Consume & Check
Consume a token on each request and check availability without consuming. The request pipeline calls Consume automatically — use these manually for custom logic.
bucket:Consume · bucket:HasTokens
→
rewards
Grant & Reset
Add tokens back to a player's bucket as a reward, replenish all active players at once, or reset a bucket to its starting value.
bucket:Grant · bucket:GrantAll · bucket:Reset
→
setup
Configuration
Set the maximum token capacity, how many tokens refill per interval, and the refill interval duration. Controls the effective request rate per player.
max · refillRate · refillInterval
→
See also
Request Pipeline | TokenBucket is stage 2 (429 on empty) ·
App | app.TokenBucket direct access ·
Port | per-port rate limiting settings ·
Tamper | flood detection using TokenBucket exhaustion signals