Function ThrottlerImpl.open

initialize a throttler for use.

void open (
  size_t tokensPerSecond,
  ulong burstSize
) nothrow @nogc @safe;

void open (
  size_t tokensPerSecond,
  ulong burstSize,
  ulong numInitialTokens
) nothrow @nogc @safe;

Parameters

NameDescription
tokensPerSecond 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 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 the number of tokens initially in the bucket. If unspecified, the bucket starts out as completely full.