Skip to content

Defined in: packages/rate-limit/src/rate-limit.ts:153

The options a token-bucket accepts: RateLimiterOptions plus the weight it regains.

readonly capacity: number

Defined in: packages/rate-limit/src/rate-limit.ts:142

The most weight one instant can admit from a fresh state. A positive safe integer.

RateLimiterOptions.capacity


readonly windowDuration: number

Defined in: packages/rate-limit/src/rate-limit.ts:147

The width of the kind’s trailing window, in the milliseconds of clock. A positive safe integer.

RateLimiterOptions.windowDuration


readonly clock: Clock

Defined in: packages/rate-limit/src/rate-limit.ts:149

The time source the meter reads through, injected so a test replays every decision.

RateLimiterOptions.clock


readonly refillAmount: number

Defined in: packages/rate-limit/src/rate-limit.ts:159

The weight the bucket regains over one RateLimiterOptions.windowDuration. A positive safe integer; a steady trickle of requests settles at one refillAmount per window.