# `ExWapp.RateLimiter`
[🔗](https://github.com/elchemista/ex_wapp/blob/v0.1.5/lib/ex_wapp/rate_limiter.ex#L1)

Applies configurable token-bucket throttling before outbound sends.

Global, per-recipient, per-group, and minimum-delay limits are combined into an
updated worker state with actionable retry information.

# `bucket`

```elixir
@type bucket() :: %{tokens: float(), last_ms: integer()}
```

# `state_data`

```elixir
@type state_data() :: %{
  global: bucket() | nil,
  per_jid: %{optional(String.t()) =&gt; bucket()},
  per_group: %{optional(String.t()) =&gt; bucket()},
  last_send_at_ms: integer() | nil
}
```

# `check_and_update`

```elixir
@spec check_and_update(map(), String.t()) :: {:ok, map()} | {:error, term(), map()}
```

# `new`

```elixir
@spec new() :: state_data()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
