Buffers and enqueues multiple jobs together.
This mirrors the upstream GoodJob::Bulk API:
Summary
Functions
Adds a job entry to the current buffer.
Returns true when the current process is buffering jobs.
Captures jobs enqueued inside the given function.
Atomically enqueues jobs.
Types
Functions
@spec add(entry()) :: {:ok, :buffered} | {:error, :not_buffering}
Adds a job entry to the current buffer.
This is used internally by GoodJob.enqueue/3.
@spec buffering?() :: boolean()
Returns true when the current process is buffering jobs.
Captures jobs enqueued inside the given function.
Returns captured job entries.
@spec enqueue((-> any()) | [GoodJob.Job.Instance.t()]) :: {:ok, [GoodJob.Job.t()]} | {:error, any()}
Atomically enqueues jobs.
Accepts either:
- a function that enqueues jobs (
perform_later/1,GoodJob.enqueue/3, etc.) - a list of
%GoodJob.Job.Instance{}