RateLimiterControl
Defined in: src/window-rate-limiter.ts:271
Manual control of the rate limiters it is passed to (control option): penalty, reward, block, unblock, delete.
key picks a partition of a partitioned limiter (omitted: every partition); single limiters ignore it.
Pass it to the partitioned limiter, not to the per-key limiters it creates.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RateLimiterControl():
RateLimiterControl
Returns
Section titled “Returns”RateLimiterControl
Methods
Section titled “Methods”block()
Section titled “block()”block(
duration,key?):void
Defined in: src/window-rate-limiter.ts:285
Reject everything (for key) for duration.
Parameters
Section titled “Parameters”duration
Section titled “duration”string
Returns
Section titled “Returns”void
delete()
Section titled “delete()”delete(
key?):Promise<void>
Defined in: src/window-rate-limiter.ts:294
Forget the state of key (or of the single limiter): fresh quota, no block.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
penalty()
Section titled “penalty()”penalty(
points,key?):Promise<void>
Defined in: src/window-rate-limiter.ts:275
Charge points permits, e.g. for a failed login.
Parameters
Section titled “Parameters”points
Section titled “points”number
string
Returns
Section titled “Returns”Promise<void>
reward()
Section titled “reward()”reward(
points,key?):Promise<void>
Defined in: src/window-rate-limiter.ts:280
Give points permits back; Infinity resets the count.
Parameters
Section titled “Parameters”points
Section titled “points”number
string
Returns
Section titled “Returns”Promise<void>
unblock()
Section titled “unblock()”unblock(
key?):void
Defined in: src/window-rate-limiter.ts:289
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void