Skip to main content
Dotset CLI API Documentation / index / RateLimiter

Class: RateLimiter

Defined in: src/mantle/utils/profiler.ts:670 Simple token bucket rate limiter

Constructors

Constructor

new RateLimiter(options): RateLimiter;
Defined in: src/mantle/utils/profiler.ts:676

Parameters

options

Returns

RateLimiter

Methods

acquire()

acquire(): Promise<void>;
Defined in: src/mantle/utils/profiler.ts:698 Acquire a token, waiting if necessary

Returns

Promise<void>

available()

available(): number;
Defined in: src/mantle/utils/profiler.ts:710 Get available tokens

Returns

number

tryAcquire()

tryAcquire(): boolean;
Defined in: src/mantle/utils/profiler.ts:686 Try to acquire a token

Returns

boolean