View Source Antikythera.TokenBucket (antikythera v0.5.1)

A thin wrapper around Foretoken to avoid collisions between bucket names by prefixing executor pool IDs.

For details, refer to Foretoken's documentation.

Summary

Functions

Link to this function

take(epool_id, bucket, milliseconds_per_token, max_tokens, tokens_to_take \\ 1)

View Source
@spec take(
  Antikythera.ExecutorPool.Id.t(),
  any(),
  pos_integer(),
  pos_integer(),
  pos_integer()
) :: :ok | {:error, pos_integer()}

Takes the specified tokens from the bucket.

Internally the actual bucket name is prefixed with the given epool_id. Note that return value on error is slightly different from that of Foretoken.take/5 (for backward compatibility).