Roger.Partition.Worker (roger v3.1.1) View Source

Handles the decoding and execution of a single job.

Besides running the job, various administrative tasks need to be performed as well, namely:

  • Check whether the job has not been cancelled in the meantime

  • Check whether another job is currently running with the same execution_key, and if so, delay this current job until the currently running one finishes

  • On job failure, the job needs to be queued in the retry queue, if the job is marked retryable. By default, jobs are not retried.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

This function starts processing the job as soon as the worker GenServer is started up.

Callback implementation for GenServer.init/1.

This will make sure the worker task is killed when the worker get's stopped

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

handle_info(:timeout, Roger.Partition.Worker.State.t()) ::
  {:noreply, Roger.Partition.Worker.State.t()}
  | {:stop, :normal, Roger.Partition.Worker.State.t()}
handle_info(:job_finished, Roger.Partition.Worker.State.t()) ::
  {:stop, :normal, Roger.Partition.Worker.State.t()}
handle_info(:job_errored, Roger.Partition.Worker.State.t()) ::
  {:stop, :normal, Roger.Partition.Worker.State.t()}
handle_info(:handle_job_timeout, Roger.Partition.Worker.State.t()) ::
  {:stop, :normal, Roger.Partition.Worker.State.t()}
handle_info(
  {:DOWN, reference(), :process, pid(), String.t()},
  Roger.Partition.Worker.State.t()
) :: {:stop, :normal, Roger.Partition.Worker.State.t()}

This function starts processing the job as soon as the worker GenServer is started up.

Callback implementation for GenServer.init/1.

Link to this function

start_link(worker_input)

View Source
Link to this function

terminate(reason, state)

View Source

Specs

terminate(any(), Roger.Partition.Worker.State.t()) :: any()

This will make sure the worker task is killed when the worker get's stopped