Hello, is it possible to create background job and Asynchronous with Task.Supervisor ? I need my code to be loaded in other thread like background job. I create these:
def register do
Task.Supervisor.async_nolink(Web.AuthController, fn ->
Process.sleep(10000)
Query.add_identity(%{
"user_id" => user_info.id
})
end)
other(email)
IO.puts "test"
conn
|> put_status(200)
|> json(%{message: "test"})
end
defp other(email) do
Task.Supervisor.async_nolink(Web.AuthController, fn ->
Process.sleep(10000)
send_email(email)
end)
end
I don’t need to load these outputs; I think they are loaded Synchronous
but I need to load Asynchronous
or I’m wrong?
is it my way true ? or I have to use Job plugin like exq
Thanks