Packages
cursornator
1.3.0
Cursor-based query and stream of Ecto records that doesn't require database transaction.
Current section
Files
Jump to
Current section
Files
lib/ecto_cursor_based_stream/task_synchronous.ex
defmodule Cursornator.TaskSynchronous do
@moduledoc false
def async(fun) do
result = fun.()
struct(Task, %{
owner: self(),
pid: self(),
ref: result,
mfa: {:erlang, :apply, [fun, []]}
})
end
def await(%Task{ref: result}, _timeout \\ 5000) do
result
end
end