RateLimiterStrategy
Defined in: src/window-rate-limiter.ts:394
Runs any RateLimiterAlgorithm as a strategy: weights, FIFO waiting up to queueTimeout, block, allow/deny, insurance, telemetry.
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”T
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RateLimiterStrategy<
T>(algorithm,options,source):RateLimiterStrategy<T>
Defined in: src/window-rate-limiter.ts:408
Parameters
Section titled “Parameters”algorithm
Section titled “algorithm”options
Section titled “options”source
Section titled “source”Returns
Section titled “Returns”RateLimiterStrategy<T>
Accessors
Section titled “Accessors”queued
Section titled “queued”Get Signature
Section titled “Get Signature”get queued():
number
Defined in: src/window-rate-limiter.ts:426
Executions waiting for permits.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”block()
Section titled “block()”block(
duration):void
Defined in: src/window-rate-limiter.ts:522
Parameters
Section titled “Parameters”duration
Section titled “duration”Returns
Section titled “Returns”void
delete()
Section titled “delete()”delete():
Promise<void>
Defined in: src/window-rate-limiter.ts:532
Fresh quota and no block.
Returns
Section titled “Returns”Promise<void>
execute()
Section titled “execute()”execute(
next,context):Promise<Outcome<T,unknown>>
Defined in: src/window-rate-limiter.ts:430
Parameters
Section titled “Parameters”Next<T>
context
Section titled “context”Returns
Section titled “Returns”Promise<Outcome<T, unknown>>
Implementation of
Section titled “Implementation of”penalty()
Section titled “penalty()”penalty(
points):Promise<void>
Defined in: src/window-rate-limiter.ts:513
Parameters
Section titled “Parameters”points
Section titled “points”number
Returns
Section titled “Returns”Promise<void>
restore()
Section titled “restore()”restore(
snapshot):void
Defined in: src/window-rate-limiter.ts:504
Loads a snapshot(); time passed since it was taken counts (windows expire, tokens refill, blocks run out).
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”Returns
Section titled “Returns”void
reward()
Section titled “reward()”reward(
points):Promise<void>
Defined in: src/window-rate-limiter.ts:517
Parameters
Section titled “Parameters”points
Section titled “points”number
Returns
Section titled “Returns”Promise<void>
snapshot()
Section titled “snapshot()”snapshot():
RateLimiterSnapshot
Defined in: src/window-rate-limiter.ts:496
The algorithm’s state and the block, JSON-serializable, for restore after a restart.
Returns
Section titled “Returns”unblock()
Section titled “unblock()”unblock():
void
Defined in: src/window-rate-limiter.ts:526
Returns
Section titled “Returns”void