I have a function that inserts a job that I’m calling twice in seeds.exs:
function_a(args1)
function_a(args2)
When running mix run priv/repo/seeds.exs
as above, whichever job is listed first gets stuck in “executing” and the other completes as expected. When running with a short sleep in between, both complete as expected:
function_a(args1)
:timer.sleep(10_000)
function_a(args1)
i’m using:
{:oban, “~> 2.19”},
{:oban_pro, “~> 1.6.0-rc.1”, repo: “oban”}
def function_a(args) do
Repo.transact(fn ->
with {:ok, result} <- function(attrs1),
{:ok, result2} <- function2(attrs2),
{:ok, job} <- JobName.new(map) |> Oban.insert() do
{:ok, %{result: result, result2: result2, job: job}}
end
end)
end