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#
| Exception | When |
|---|---|
InvalidArgumentException | If $eventsPerSecond is not above 0 |
LogicException | Outside a coroutine |