Verk v1.7.0 Verk.RetrySet

This module interacts with jobs in the retry set

Link to this section Summary

Functions

Adds a job to the retry set ordering by timestamp

Adds a job to the retry set ordering by timestamp, raising if there's an error

Clears the retry set

Clears the retry set, raising if there's an error

Counts how many jobs are inside the retry set

Counts how many jobs are inside the retry set, raising if there's an error

Delete the job from the retry set

Delete the job from the retry set, raising if there's an error

Redis retry set key

List jobs from start to stop, raising if there's an error

List jobs from start to stop including their scores

List jobs from start to stop including their scores, raising if there's an error

Move the job out of the retry set to be retried immediately

Move the job out of the retry set to be retried immediately, raising if there's an error

Link to this section Functions

Link to this function

add(job, failed_at, redis \\ Verk.Redis)
add(
  %Verk.Job{
    args: term(),
    class: term(),
    created_at: term(),
    enqueued_at: term(),
    error_backtrace: term(),
    error_message: term(),
    failed_at: term(),
    finished_at: term(),
    jid: term(),
    max_retry_count: term(),
    original_json: term(),
    queue: term(),
    retried_at: term(),
    retry_count: term()
  },
  integer(),
  GenServer.server()
) :: :ok | {:error, Redix.Error.t()}

Adds a job to the retry set ordering by timestamp

Optionally a redis connection can be specified

Link to this function

add!(job, failed_at, redis \\ Verk.Redis)
add!(
  %Verk.Job{
    args: term(),
    class: term(),
    created_at: term(),
    enqueued_at: term(),
    error_backtrace: term(),
    error_message: term(),
    failed_at: term(),
    finished_at: term(),
    jid: term(),
    max_retry_count: term(),
    original_json: term(),
    queue: term(),
    retried_at: term(),
    retry_count: term()
  },
  integer(),
  GenServer.server()
) :: nil

Adds a job to the retry set ordering by timestamp, raising if there's an error

Optionally a redis connection can be specified

Link to this function

clear(redis \\ Verk.Redis)
clear(GenServer.server()) :: {:ok, boolean()} | {:error, Redix.Error.t()}

Clears the retry set

It will return {:ok, true} if the retry set was cleared and {:ok, false} otherwise

An error tuple may be returned if Redis failed

Link to this function

clear!(redis \\ Verk.Redis)
clear!(GenServer.server()) :: boolean()

Clears the retry set, raising if there's an error

It will return true if the retry set was cleared and false otherwise

Link to this function

count(redis \\ Verk.Redis)
count(GenServer.Server) :: {:ok, integer()} | {:error, Redix.Error.t()}

Counts how many jobs are inside the retry set

Link to this function

count!(redis \\ Verk.Redis)
count!(GenServer.Server) :: integer()

Counts how many jobs are inside the retry set, raising if there's an error

Link to this function

delete_job(original_json, redis \\ Verk.Redis)
delete_job(
  %Verk.Job{
    args: term(),
    class: term(),
    created_at: term(),
    enqueued_at: term(),
    error_backtrace: term(),
    error_message: term(),
    failed_at: term(),
    finished_at: term(),
    jid: term(),
    max_retry_count: term(),
    original_json: term(),
    queue: term(),
    retried_at: term(),
    retry_count: term()
  }
  | String.t(),
  GenServer.server()
) :: {:ok, boolean()} | {:error, Redix.Error.t()}

Delete the job from the retry set

It returns {:ok, true} if the job was found and deleted Otherwise it returns {:ok, false}

An error tuple may be returned if Redis failed

Link to this function

delete_job!(original_json, redis \\ Verk.Redis)
delete_job!(
  %Verk.Job{
    args: term(),
    class: term(),
    created_at: term(),
    enqueued_at: term(),
    error_backtrace: term(),
    error_message: term(),
    failed_at: term(),
    finished_at: term(),
    jid: term(),
    max_retry_count: term(),
    original_json: term(),
    queue: term(),
    retried_at: term(),
    retry_count: term()
  }
  | String.t(),
  GenServer.server()
) :: boolean()

Delete the job from the retry set, raising if there's an error

It returns true if the job was found and delete Otherwise it returns false

Redis retry set key

Link to this function

range(start \\ 0, stop \\ -1, redis \\ Verk.Redis)
range(integer(), integer(), GenServer.server()) ::
  {:ok, [Verk.Job.T]} | {:error, Redix.Error.t()}

List jobs from start to stop

Link to this function

range!(start \\ 0, stop \\ -1, redis \\ Verk.Redis)
range!(integer(), integer(), GenServer.server()) :: [Verk.Job.T]

List jobs from start to stop, raising if there's an error

Link to this function

range_with_score(start \\ 0, stop \\ -1, redis \\ Verk.Redis)
range_with_score(integer(), integer(), GenServer.server()) ::
  {:ok, [{Verk.Job.T, integer()}]} | {:error, Redix.Error.t()}

List jobs from start to stop including their scores

Link to this function

range_with_score!(start \\ 0, stop \\ -1, redis \\ Verk.Redis)
range_with_score!(integer(), integer(), GenServer.server()) :: [
  {Verk.Job.T, integer()}
]

List jobs from start to stop including their scores, raising if there's an error

Link to this function

requeue_job(original_json, redis \\ Verk.Redis)
requeue_job(
  %Verk.Job{
    args: term(),
    class: term(),
    created_at: term(),
    enqueued_at: term(),
    error_backtrace: term(),
    error_message: term(),
    failed_at: term(),
    finished_at: term(),
    jid: term(),
    max_retry_count: term(),
    original_json: term(),
    queue: term(),
    retried_at: term(),
    retry_count: term()
  }
  | String.t(),
  GenServer.server()
) :: {:ok, boolean()} | {:error, Redix.Error.t()}

Move the job out of the retry set to be retried immediately

It returns {:ok, true} if the job was found and requeued Otherwise it returns {:ok, false}

An error tuple may be returned if Redis failed

Link to this function

requeue_job!(original_json, redis \\ Verk.Redis)
requeue_job!(
  %Verk.Job{
    args: term(),
    class: term(),
    created_at: term(),
    enqueued_at: term(),
    error_backtrace: term(),
    error_message: term(),
    failed_at: term(),
    finished_at: term(),
    jid: term(),
    max_retry_count: term(),
    original_json: term(),
    queue: term(),
    retried_at: term(),
    retry_count: term()
  }
  | String.t(),
  GenServer.server()
) :: boolean()

Move the job out of the retry set to be retried immediately, raising if there's an error

It returns true if the job was found and requeued Otherwise it returns false