Oban.insert

You're seeing just the function insert, go back to Oban module for more information.
Link to this function

insert(name \\ __MODULE__, changeset)

View Source (since 0.7.0)

Specs

insert(name(), Oban.Job.changeset()) ::
  {:ok, Oban.Job.t()} | {:error, Oban.Job.changeset()} | {:error, term()}

Insert a new job into the database for execution.

This and the other insert variants are the recommended way to enqueue jobs because they support features like unique jobs.

See the section on "Unique Jobs" for more details.

Example

Insert a single job:

{:ok, job} = Oban.insert(MyApp.Worker.new(%{id: 1}))

Insert a job while ensuring that it is unique within the past 30 seconds:

{:ok, job} = Oban.insert(MyApp.Worker.new(%{id: 1}, unique: [period: 30]))
Link to this function

insert(name \\ __MODULE__, multi, multi_name, changeset_or_fun)

View Source (since 0.7.0)

Specs

insert(
  name(),
  multi :: Ecto.Multi.t(),
  multi_name :: Ecto.Multi.name(),
  changeset_or_fun :: Oban.Job.changeset() | Oban.Job.changeset_fun()
) :: Ecto.Multi.t()

Put a job insert operation into an Ecto.Multi.

Like insert/2, this variant is recommended over Ecto.Multi.insert because it supports all of Oban's features, i.e. unique jobs.

See the section on "Unique Jobs" for more details.

Example

Ecto.Multi.new()
|> Oban.insert("job-1", MyApp.Worker.new(%{id: 1}))
|> Oban.insert("job-2", fn _ -> MyApp.Worker.new(%{id: 2}) end)
|> MyApp.Repo.transaction()