A handle to one asynchronous query.
Every synchronous Gitility call is implemented over a job; the async_*
variants return the job directly.
{:ok, job} = Gitility.async_search(snapshot, "def handle_call", [])
case Gitility.Job.await(job, 30_000) do
{:ok, page} -> page
{:error, %Gitility.Error{code: :await_timeout}} -> # still running
{:error, %Gitility.Error{code: :timeout}} -> # budget expired, cancelled
endThe two timeouts
await/2 timing out returns :await_timeout and leaves the job
running — await again, cancel, or abandon it. The job's own
timeout_ms budget expiring cancels the work and completes the job as
:timeout. The synchronous wrappers pass the budget and await it plus a
grace period; if that await expires, they cancel their internal job, wait
once more for terminal delivery, and return :timeout. Sync callers never
see :await_timeout and never abandon their internal work.
A result rejected as :result_too_large has already been removed from its
take-once native slot and discarded. It is intentionally unrecoverable: the
result byte limit belongs to the job and cannot be raised by awaiting again.
Ownership
Jobs are owned by the calling process. Caller death cancels caller-owned
jobs — abandonment is safe, nothing leaks — unless the job was started
with detach: true. Cancellation sets an interrupt checked throughout
walks, scans, diffs, blame, provider waits, and pack decoding.
Summary
Functions
Waits for the job's result. :await_timeout leaves the job running
(retryable: true); all other errors are the job's own outcome.
Cancels the job. Idempotent; a completed job is unaffected. Cancellation latency is bounded — native work checks the interrupt at every loop.
The job's current lifecycle state.
Types
Functions
@spec await(t(), timeout()) :: {:ok, term()} | {:error, Gitility.Error.t()}
Waits for the job's result. :await_timeout leaves the job running
(retryable: true); all other errors are the job's own outcome.
@spec cancel(t()) :: :ok
Cancels the job. Idempotent; a completed job is unaffected. Cancellation latency is bounded — native work checks the interrupt at every loop.
The job's current lifecycle state.