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.
28 lines
635 B
Elixir
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
|