prop/vendor/oban_pro/lib/oban/pro/limiter.ex
Graham McIntire 0db5c2ae3e Vendor oban_pro 1.6.13
Adds the commercial Oban Pro package (vendored from the towerops-web2
vendor tree) so this project can use its workers, plugins, and
Smart engine features.
2026-04-09 14:14:49 -05:00

28 lines
635 B
Elixir

defmodule Oban.Pro.Limiter do
@moduledoc false
alias Oban.Pro.Producer
alias Oban.{Config, Job}
@type changes :: %{
:conf => Config.t(),
:prod => Producer.t(),
:running => map(),
optional(atom()) => any()
}
@type demand :: non_neg_integer()
@type limit :: nil | demand | [{demand, term(), term()}]
@type repo :: Ecto.Repo.t()
@doc """
Calculate the current demand based on capacity and usage.
"""
@callback check(repo(), changes()) :: {:ok, limit()}
@doc """
Record demand usage.
"""
@callback track(Producer.meta(), [Job.t()]) :: Producer.meta()
end