Core.Workers.Worker (Elixir Server Core v0.1.1)

Copy Markdown View Source

Background job worker. Polls the JobQueue every @poll_interval ms, claims the next available job, executes it, and updates its status.

Designed to run in a pool via Core.Workers.WorkerPool. Each worker process operates independently — there is no cross-worker coordination needed because JobQueue serializes claim_next/0 via GenServer.call.

Telemetry events emitted

  • [:core, :job, :start] — when a job begins executing metadata: %{job_id: id, attempt: n, payload: map}
  • [:core, :job, :stop] — when a job completes successfully measurements: %{duration: native_time} metadata: %{job_id: id}
  • [:core, :job, :error] — when a job raises an exception measurements: %{duration: native_time} metadata: %{job_id: id, error: string}

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])