ThrottlerImpl.withdraw

Withdraw tokens from the bucket.

Unless AllowOverdraft is true, the amount of tokens requested must be smaller than the burst size. If AllowOverdraft is false and there is insufficient ballance, or if AllowOverdraft is true but the ballance is negative, then the requester is paused until all prior reuqesters have been served and the ballance is high enough to serve the current request.

struct ThrottlerImpl(bool AllowOverdraft = false)
@safe @nogc
void
withdraw

Parameters

tokens ulong

number of tokens to withdraw.

timeout Timeout

sets a timeout for the wait.

Throws

TimeoutExpired if the timeout expires.

Any other exception injected to this fiber using Reactor.throwInFiber

Meta