# `Slink.Rate`
[🔗](https://github.com/wkirschbaum/slink/blob/v0.6.0/lib/slink/rate.ex#L1)

Per-channel outbound rate limiting for Slack Web API calls.

Slack limits `chat.postMessage` to roughly **one message per second per
channel**; bursts beyond that get `429`s and dropped messages. This module
fronts outbound calls with one lightweight `GenServer` per channel (see
`Slink.Rate.Channel`), each draining a FIFO queue no faster than the
configured interval. Different channels drain concurrently.

Calls are fire-and-forget: failures are logged, not returned. Use
`Slink.API` directly if you need the response.

## Configuration

  * `config :slink, :rate_interval_ms, 1_000` — minimum gap between sends on a
    single channel (default 1000ms).
  * `config :slink, :rate_max_queue, 1_000` — per-channel queue cap; beyond it
    the oldest queued messages are dropped (default 1000).
  * `config :slink, :rate_idle_stop_ms, 600_000` — a channel worker with
    nothing to do for this long stops itself (default 10 minutes), so posting
    to many channels doesn't accumulate idle workers.

`:rate_mode` and `:rate_sender` also exist but are **internal test seams**
(set by `Slink.Testing.run/3`): `:sync` performs sends inline with no
pacing, no queue bound and swallowed errors. Never set them in production.

# `enqueue`

Queue any Web API `method` targeting `channel`, rate-limited per channel.

# `post_message`

Queue a `chat.postMessage` for `channel`, rate-limited per channel.

---

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