JoobQ.RateLimits (joobq_ex v0.8.0)

Copy Markdown View Source

Sliding-window rate limits kept by the gateway (JoobQ Pro): JoobQ.rate_limit/4 reserves a slot with POST /sdk/rate-limit, checking and consuming it in one step. It answers {:ok, %{"allowed" => true, ...}} when a slot was granted, or "allowed" => false with "retry_after_ms", the milliseconds until one frees up. It paces your own code (an enqueue, a call to a partner); it does not enqueue or wait. Without a Pro licence the gateway answers 402: {:error, %JoobQ.Error{reason: :pro_required}}.

Summary

Functions

The body of POST /sdk/rate-limit; raises ArgumentError naming a wrong argument, never its value.

Functions

body(key, limit, period_ms)

@spec body(String.t(), pos_integer(), pos_integer()) :: map()

The body of POST /sdk/rate-limit; raises ArgumentError naming a wrong argument, never its value.