Verk.SortedSet (Verk v1.7.2) View Source

This module interacts with the jobs on a sorted set.

Link to this section Summary

Functions

Clears the sorted set.

Clears the sorted set, raising if there's an error.

Counts how many jobs are inside the sorted set.

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

Deletes the job from the sorted set.

Deletes the job from the sorted set, raising if there's an error.

Lists jobs from start to stop.

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

Lists jobs from start to stop along with the item scores.

Lists jobs from start to stop along with the item scores, raising if there's an error.

Moves the job from the sorted set back to its original queue.

Moves the job from the sorted set back to its original queue, raising if there's an error.

Link to this section Functions

Specs

clear(String.t(), GenServer.server()) ::
  {:ok, boolean()} | {:error, Redix.Error.t()}

Clears the sorted set.

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

An error tuple may be returned if Redis failed.

Specs

clear!(String.t(), GenServer.server()) :: boolean()

Clears the sorted set, raising if there's an error.

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

Specs

count(String.t(), GenServer.server()) ::
  {:ok, integer()} | {:error, Redix.Error.t()}

Counts how many jobs are inside the sorted set.

Specs

count!(String.t(), GenServer.server()) :: integer()

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

Link to this function

delete_job(key, original_json, redis)

View Source

Specs

delete_job(
  String.t(),
  %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()}

Deletes the job from the sorted 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!(key, original_json, redis)

View Source

Specs

delete_job!(
  String.t(),
  %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()

Deletes the job from the sorted set, raising if there's an error.

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

Link to this function

range(key, start \\ 0, stop \\ -1, redis)

View Source

Specs

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

Lists jobs from start to stop.

Link to this function

range!(key, start \\ 0, stop \\ -1, redis)

View Source

Specs

range!(String.t(), integer(), integer(), GenServer.server()) :: nil

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

Link to this function

range_with_score(key, start \\ 0, stop \\ -1, redis)

View Source

Specs

range_with_score(String.t(), integer(), integer(), GenServer.server()) ::
  {:ok, [{Verk.Job.T, integer()}]} | {:error, Redix.Error.t()}

Lists jobs from start to stop along with the item scores.

Link to this function

range_with_score!(key, start \\ 0, stop \\ -1, redis)

View Source

Specs

range_with_score!(String.t(), integer(), integer(), GenServer.server()) :: nil

Lists jobs from start to stop along with the item scores, raising if there's an error.

Link to this function

requeue_job(key, original_json, redis)

View Source

Specs

requeue_job(
  String.t(),
  %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()}

Moves the job from the sorted set back to its original queue.

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

View Source

Specs

requeue_job!(
  String.t(),
  %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()

Moves the job from the sorted set back to its original queue, raising if there's an error.

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