snapcap
API ReferenceType Aliases

ThrottleGate

Type Alias: ThrottleGate

type ThrottleGate = (url: string) => Promise<void>;

Defined in: transport/throttle.ts:94

Function shape that throttles outbound requests. Awaited once per wire request, immediately before the SDK calls into the underlying fetch / XHR layer.

Parameters

ParameterTypeDescription
urlstringThe destination URL of the imminent request. Used to match ThrottleRule.match patterns. Implementations should resolve immediately for unmatched URLs.

Returns

Promise<void>

A promise that resolves once the request is allowed to proceed.

Remarks

Pass a ThrottleConfig to a SnapcapClient for per-instance pacing, OR build a shared gate via createSharedThrottle and pass it to every client when coordinating across many tenants in one process.

See

createSharedThrottle

On this page