AuroraMeter.Oban.EventsReplay (Aurora Meter v1.0.0)

View Source

Runs AuroraMeter.Events.Replay.run/1 as a job, for an operator who would rather not hold an iex session open for an hour.

It has no schedule and AuroraMeter.Oban.cron_entries/1 never returns it. Rebuilding a projection generation is a deliberate act with a checkpoint behind it, not something that should begin because a minute elapsed. Enqueue it by hand:

%{"batch_size" => 5_000, "activate" => false}
|> AuroraMeter.Oban.EventsReplay.new()
|> Oban.insert()

max_attempts: 1, and that is the point of running it here rather than under a worker that retries. A replay resumes from its own checkpoint, so an automatic retry of a run an operator started would continue work they may have stopped on purpose. A failed job is visible, and the next run/1 carries on from the cursor.

Job arguments

Every option AuroraMeter.Events.Replay.run/1 takes, as a string key: "batch_size", "compare" ("require_match" or "report"), "activate", "resume", "generation", "compare_limit", "max_batches", "rehydrate" and "timeout".

A paused replay returns {:ok, status} from the job: the run stopped cleanly at a batch boundary and everything is in place for the next one.

Summary

Functions

Runs one replay and returns {:ok, report}, {:ok, status} for a paused run, or {:error, reason}.

Functions

perform(job)

@spec perform(Oban.Job.t()) ::
  :ok | {:ok, term()} | {:error, term()} | {:cancel, term()}

Runs one replay and returns {:ok, report}, {:ok, status} for a paused run, or {:error, reason}.

Examples

{:ok, report} =
  AuroraMeter.Oban.EventsReplay.perform(%Oban.Job{args: %{"activate" => false}})