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

View Source

Leaky bucket — paces requests at a steady drain rate. Rejects with {:error, :overflow} when the queue is saturated.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start a leaky-bucket limiter.

Types

opts()

@type opts() :: [
  capacity: pos_integer(),
  leak_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 leaky-bucket limiter.