DripDrop.Dispatch.Steps (DripDrop v0.1.0)

Copy Markdown View Source

Creates and enqueues step execution rows for enrollments.

Summary

Functions

Moves a step execution back to scheduled state at a new time.

Creates and enqueues one step execution for an enrollment.

Calculates the next scheduled time for a step from its timing config.

Bulk seeds executions for active enrollments eligible for a step.

Functions

reschedule(execution, scheduled_for)

@spec reschedule(Ecto.Schema.t(), DateTime.t()) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}

Moves a step execution back to scheduled state at a new time.

schedule(enrollment, step, opts \\ [])

@spec schedule(Ecto.Schema.t(), Ecto.Schema.t(), keyword()) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}

Creates and enqueues one step execution for an enrollment.

scheduled_for(step)

@spec scheduled_for(Ecto.Schema.t()) :: DateTime.t()

Calculates the next scheduled time for a step from its timing config.

seed_for_step(step, scheduled_for, opts \\ [])

@spec seed_for_step(Ecto.Schema.t(), DateTime.t(), keyword()) ::
  {:ok, [Ecto.Schema.t()]} | {:error, term()}

Bulk seeds executions for active enrollments eligible for a step.