PermitRateLimiterOptions
Defined in: src/window-rate-limiter.ts:318
Extends
Section titled “Extends”RejectionOptions
Extended by
Section titled “Extended by”Properties
Section titled “Properties”allow?
Section titled “allow?”
optionalallow?: (context) =>boolean
Defined in: src/window-rate-limiter.ts:328
Bypass the limiter, e.g. internal callers.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”boolean
blockDuration?
Section titled “blockDuration?”
optionalblockDuration?:Duration
Defined in: src/window-rate-limiter.ts:326
Once an execution is rejected for exceeding the limit, reject everything for this long (brute-force protection).
control?
Section titled “control?”
optionalcontrol?:RateLimiterControl
Defined in: src/window-rate-limiter.ts:331
optionaldeny?: (context) =>boolean
Defined in: src/window-rate-limiter.ts:330
Reject with RateLimiterDeniedError right away (checked before allow).
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”boolean
insurance?
Section titled “insurance?”
optionalinsurance?:object
Defined in: src/window-rate-limiter.ts:336
In-memory fallback for a remote algorithm: when acquire throws or exceeds timeout, algorithm answers instead
and OnRateLimiterInsuranceUsed is reported. Size it per process (e.g. the shared limit / instances).
algorithm
Section titled “algorithm”algorithm:
RateLimiterAlgorithm
timeout?
Section titled “timeout?”
optionaltimeout?:Duration
minTime?
Section titled “minTime?”
optionalminTime?:Duration
Defined in: src/window-rate-limiter.ts:343
Least time between the starts of two granted executions (bottleneck’s minTime); also the floor of 'even' spacing.
optionalname?:string
Defined in: src/window-rate-limiter.ts:306
Inherited from
Section titled “Inherited from”RejectionOptions.name
onRejected?
Section titled “onRejected?”
optionalonRejected?: (args) =>MaybePromise<void>
Defined in: src/window-rate-limiter.ts:307
Parameters
Section titled “Parameters”Returns
Section titled “Returns”MaybePromise<void>
Inherited from
Section titled “Inherited from”RejectionOptions.onRejected
permits?
Section titled “permits?”
optionalpermits?: (context) =>number
Defined in: src/window-rate-limiter.ts:320
Weight of an execution (e.g. batch size, cost). Default 1.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”number
queueLimit?
Section titled “queueLimit?”
optionalqueueLimit?:number
Defined in: src/window-rate-limiter.ts:324
Most executions waiting (with queueTimeout); beyond it they are rejected at once. Default: no limit, as queueTimeout (default 0) already decides whether anyone waits.
queueTimeout?
Section titled “queueTimeout?”
optionalqueueTimeout?:Duration
Defined in: src/window-rate-limiter.ts:322
Longest an execution may wait for permits before it is rejected. Waiters are served first come, first served. Default 0: reject right away.
spacing?
Section titled “spacing?”
optionalspacing?:"even"
Defined in: src/window-rate-limiter.ts:341
'even': delays granted executions so the quota left is spread evenly until the limit resets, instead of
bursting at the start of the window. The delay counts against queueTimeout when that is set; abort ends it.