Concurrency control for jobs.
Allows limiting the number of concurrent jobs per concurrency key, and throttling job enqueueing/execution.
Summary
Functions
Checks if a job can be enqueued based on concurrency limits.
Checks if a job can be performed based on concurrency limits.
Functions
Checks if a job can be enqueued based on concurrency limits.
Returns {:ok, :ok} if allowed.
If the limit or throttle is exceeded, or the advisory lock could not be taken, the result is
{:ok, {:error, reason}} where reason is :limit_exceeded, :throttle_exceeded, or
:lock_failed. That shape comes from Ecto.Repo.transaction/1 wrapping the callback return
value (not a rolled-back transaction).
Checks if a job can be performed based on concurrency limits.
Returns {:ok, :ok} if allowed.
Otherwise returns {:ok, {:error, reason}} with reason in :limit_exceeded, :throttle_exceeded,
or :lock_failed (see check_enqueue_limit/2 for why this is {:ok, {:error, _}}).