Previous commit (3c988a5f) switched oban_pro to the licensed hex repo at deploy time. Reverting that — keep all three Pro packages vendored so prod image builds don't depend on oban.pro reachability or auth on every CI run. oban_pro 1.7.0 dropped into vendor/oban_pro via `mix hex.package fetch oban_pro 1.7.0 --repo=oban --unpack`. mix.exs goes back to `path: "vendor/oban_pro"` (matching oban_met / oban_web, which were already vendored — and stay vendored since the licensed repo only has older versions of those: 0.1.11 / 2.10.6 vs the 1.1.0 / 2.12.1 we vendor). Schema migration from3c988a5fstays — 1.7.0 tables/indexes are already applied. No code changes.
22 lines
905 B
Elixir
22 lines
905 B
Elixir
defmodule Oban.Pro.Validation do
|
|
@moduledoc false
|
|
|
|
# Shared validations for use with `Oban.Validation.validate/2,3`
|
|
|
|
@doc """
|
|
Validate `by:` options for partitioning workers.
|
|
"""
|
|
def validate_by(:worker), do: :ok
|
|
def validate_by([{:args, key}]) when is_atom(key), do: :ok
|
|
def validate_by([{:meta, key}]) when is_atom(key), do: :ok
|
|
def validate_by([{:args, [key | _]}]) when is_atom(key), do: :ok
|
|
def validate_by([{:meta, [key | _]}]) when is_atom(key), do: :ok
|
|
def validate_by([:worker, {:args, key}]) when is_atom(key), do: :ok
|
|
def validate_by([:worker, {:meta, key}]) when is_atom(key), do: :ok
|
|
def validate_by([:worker, {:args, [key | _]}]) when is_atom(key), do: :ok
|
|
def validate_by([:worker, {:meta, [key | _]}]) when is_atom(key), do: :ok
|
|
|
|
def validate_by(fields) do
|
|
{:error, "expected :by to be :worker or an :args/:meta tuple, got: #{inspect(fields)}"}
|
|
end
|
|
end
|