PgFlow.Worker.StalledTaskRecovery (PgFlow v0.1.0)

Copy Markdown View Source

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)

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the StalledTaskRecovery GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(config)

@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)