testing/testing_rate_limiter.ts view source
RateLimiter plus bucket tracking. Every check/record call adds
its key to #seen_keys; reset removes it; reset_all clears every
tracked bucket. Drop-in replacement anywhere a RateLimiter is
expected — the type is nominally compatible via subclassing.
inheritance
check
type (key: string, now?: number | undefined): RateLimitResult
key
stringnow?
number | undefinedrecord
type (key: string, now?: number | undefined): RateLimitResult
key
stringnow?
number | undefinedreset
type (key: string): void
key
stringvoidreset_all
Clear every bucket this limiter has been asked about. Idempotent;
safe to call before any check/record activity. Designed to be invoked
from a _testing_reset handler's reset_state callback so the test
binary's rate-limit buckets don't leak across test cases.
type (): void
void