ThrottlerImpl.open

initialize a throttler for use.

  1. void open(size_t tokensPerSecond, ulong burstSize)
  2. void open(size_t tokensPerSecond, ulong burstSize, ulong numInitialTokens)
    struct ThrottlerImpl(bool AllowOverdraft = false)
    nothrow @safe @nogc
    void
    open

Parameters

tokensPerSecond size_t

the rate at which new tokens are deposited at the bucket. Actual rate might vary slightly due to rounding errors. In general, the lower the number, the lower the error.

burstSize ulong

the maximal number of tokens that the bucket may hold. Unless overdraft is allowed, this is also the maximal amount that a single withdrawl may request.

numInitialTokens ulong

the number of tokens initially in the bucket. If unspecified, the bucket starts out as completely full.

Meta