roger v2.0.0 Roger.Partition.Worker 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
This is called when job needs to be cancelled it kills running job and runs the timeout task to correctly finish the job
This handle a hard crash
This will make sure the worker task is killed when the worker get’s stopped
Link to this section Functions
handle_call(:cancel_job, any(), Roger.Partition.Worker.State.t()) :: {:reply, :ok, Roger.Partition.Worker.State.t(), 0}
This is called when job needs to be cancelled it kills running job and runs the timeout task to correctly finish the job.
handle_info({:DOWN, reference(), :process, pid(), String.t()}, 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(:job_errored, 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(:timeout, Roger.Partition.Worker.State.t()) ::
{:noreply, Roger.Partition.Worker.State.t()} |
{:stop, :normal, Roger.Partition.Worker.State.t()}
This handle a hard crash
terminate(any(), Roger.Partition.Worker.State.t()) :: any()
This will make sure the worker task is killed when the worker get’s stopped