Verk.Queue (Verk v1.7.2) View Source

This module interacts with a queue.

Link to this section Summary

Functions

Clears the queue

Clears the queue, raising if there's an error.

Counts how many jobs are enqueued on a queue.

Counts how many jobs are enqueued on a queue, raising if there's an error.

Deletes the job from the queue.

Delete job from the queue, raising if there's an error.

Lists enqueued jobs from start to stop.

Lists enqueued jobs from start to stop, raising if there's an error.

Link to this section Functions

Specs

clear(binary()) :: {:ok, boolean()} | {:error, Redix.Error.t()}

Clears the queue

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

An error tuple may be returned if Redis failed.

Specs

clear!(binary()) :: boolean()

Clears the queue, raising if there's an error.

It will return true if the queue was cleared and false otherwise.

Specs

count(binary()) :: {:ok, integer()} | {:error, atom() | Redix.Error.t()}

Counts how many jobs are enqueued on a queue.

Specs

count!(binary()) :: integer()

Counts how many jobs are enqueued on a queue, raising if there's an error.

Link to this function

delete_job(queue, original_json)

View Source

Specs

delete_job(
  binary(),
  %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()
  }
  | binary()
) :: {:ok, boolean()} | {:error, Redix.Error.t()}

Deletes the job from the queue.

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!(queue, original_json)

View Source

Specs

delete_job!(
  binary(),
  %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()
  }
  | binary()
) :: boolean()

Delete job from the queue, raising if there's an error.

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

An error will be raised if Redis failed.

Link to this function

range(queue, start \\ 0, stop \\ -1)

View Source

Specs

range(binary(), integer(), integer()) ::
  {:ok, [Verk.Job.T]} | {:error, Redix.Error.t()}

Lists enqueued jobs from start to stop.

Link to this function

range!(queue, start \\ 0, stop \\ -1)

View Source

Specs

range!(binary(), integer(), integer()) :: [Verk.Job.T]

Lists enqueued jobs from start to stop, raising if there's an error.