Durable.Queue.Worker (Durable v0.1.0-rc)

View Source

Executes a single workflow job in an isolated process.

Each worker runs under a DynamicSupervisor with restart: :temporary, ensuring that:

  • Each workflow execution is isolated
  • A crash in one worker does not affect others
  • Workers are not automatically restarted (stale lock recovery handles retries)

The worker spawns job execution in a separate Task, allowing the GenServer to send periodic heartbeats to update locked_at and prevent stale lock recovery from incorrectly reclaiming long-running jobs.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a worker process to execute a job.

Types

t()

@type t() :: %Durable.Queue.Worker{
  config: Durable.Config.t(),
  heartbeat_timer: reference() | nil,
  job: map(),
  poller_pid: pid(),
  started_at: integer(),
  task_pid: pid() | nil,
  task_ref: reference() | nil
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

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

Starts a worker process to execute a job.

Options

  • :job - The job map to execute (required)
  • :config - The Durable configuration (required)
  • :poller_pid - The poller process to report completion to (required)