# `PhoenixMountable.Backfill.Runner`
[🔗](https://github.com/hattoriai/phoenix_mountable/blob/v0.2.1/lib/phoenix_mountable/backfill.ex#L225)

Runs a library's deferred backfills in the running app.

Add it to the host's supervision tree after the repo, or to the library's
`c:PhoenixMountable.children/1`:

    {PhoenixMountable.Backfill.Runner, migrations: MyLib.Migrations, repo: MyApp.Repo}

On start it runs every pending backfill, batch by batch, recording the
cursor after each batch, so a restart resumes where it stopped. On
Postgres and MySQL it takes a database lock per backfill, so several nodes
can run the runner and each backfill still runs once at a time. A batch
that fails marks the backfill `failed` with the error; it is retried with
a backoff.

## Options

  * `:migrations` (required), `:repo` (required), `:prefix`
  * `:retry_after` — milliseconds before retrying a failed backfill.
    Defaults to `30_000`.

# `run_all`

```elixir
@spec run_all(module(), keyword()) :: :ok | {:error, [{String.t(), term()}]}
```

Runs every pending backfill of `migrations` to completion, in the caller.

Returns `:ok`, or `{:error, failed}` with the backfills that failed.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
