# `PgFlow.Worker.StalledTaskRecovery`
[🔗](https://github.com/agoodway/pgflow/blob/v0.1.0/lib/pgflow/worker/stalled_task_recovery.ex#L1)

Periodically recovers stalled tasks stuck in 'started' status.

If a worker crashes while processing tasks, those tasks remain in 'started'
status in the step_tasks table. The pgmq message eventually becomes visible
again, but `start_tasks` can't re-process it because the step_task record
is stuck. This GenServer periodically finds and resets those records.

## Configuration

  * `:recovery_interval` - Milliseconds between recovery sweeps (default: 15_000)
  * `:stale_threshold` - Seconds after which a started task is considered stalled (default: 60)

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the StalledTaskRecovery GenServer.

## Options

  * `:repo` - (required) The Ecto repository module
  * `:recovery_interval` - Milliseconds between sweeps (default: 15_000)
  * `:stale_threshold` - Seconds threshold for stale tasks (default: 60)

---

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