Skip to main content

NewRateLimiter

Creates a new rate-limiter with the specified transactions per second (tps) and burst values.

def NewRateLimiter(
rateLimiterName: string,
tps: float64,
burst: int
) - > RateLimiter

Creates a new rate-limiter with the specified transactions per second (tps) and burst values. Callers use this to control the rate at which operations can be performed.

Parameters

NameTypeDescription
rateLimiterNamestringThe name to assign to the rate limiter, used for identification or logging purposes.
tpsfloat64The desired rate limit in transactions per second (TPS). This defines how many operations are allowed per second on average.
burstintThe maximum burst size allowed. This specifies how many operations can exceed the TPS limit in a short period before being throttled.

Returns

TypeDescription
RateLimiterA new RateLimiter instance configured with the given tps and burst limits.