phasync
RateLimiter / __construct

Method

RateLimiter::__construct

Creates the limiter and starts its coroutine.

Description#

public RateLimiter::__construct(
    float $eventsPerSecond,
    int $burst = 0
)

Parameters#

$eventsPerSecond float
The rate, above 0
$burst int = 0
Permits that may accumulate while nobody waits

Errors / Exceptions#

ExceptionWhen
InvalidArgumentExceptionIf $eventsPerSecond is not above 0
LogicExceptionOutside a coroutine