SlidingWindowRateLimiterOptions
Defined in: src/window-rate-limiter.ts:369
Extends
Section titled “Extends”Properties
Section titled “Properties”alignment?
Section titled “alignment?”
optionalalignment?:"fixed"|"first-request"
Defined in: src/window-rate-limiter.ts:366
'fixed' (default): windows follow each other from the limiter’s creation. 'first-request': a window starts at
the first request after the previous one ended (per partition, when partitioned).
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.alignment
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
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.allow
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).
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.blockDuration
control?
Section titled “control?”
optionalcontrol?:RateLimiterControl
Defined in: src/window-rate-limiter.ts:331
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.control
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
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.deny
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
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.insurance
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.
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.minTime
optionalname?:string
Defined in: src/window-rate-limiter.ts:306
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.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”FixedWindowRateLimiterOptions.onRejected
permitLimit
Section titled “permitLimit”permitLimit:
number
Defined in: src/window-rate-limiter.ts:360
Permits granted per window.
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.permitLimit
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
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.permits
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.
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.queueLimit
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.
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.queueTimeout
segmentsPerWindow?
Section titled “segmentsPerWindow?”
optionalsegmentsPerWindow?:number
Defined in: src/window-rate-limiter.ts:371
Buckets the window slides by. More = smoother and more exact, at O(segments) per call. Default 10.
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.
Inherited from
Section titled “Inherited from”FixedWindowRateLimiterOptions.spacing
window
Section titled “window”window:
Duration
Defined in: src/window-rate-limiter.ts:361