Coffrify.Runtime.RateLimit.TokenBucket (Coffrify v0.9.0)

View Source

Classic token bucket. Allows bursts up to capacity and refills at refill_per_second tokens/second.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start a token-bucket limiter.

Types

opts()

@type opts() :: [
  capacity: pos_integer(),
  refill_per_second: pos_integer(),
  name: GenServer.name()
]

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(opts()) :: GenServer.on_start()

Start a token-bucket limiter.