Que v0.3.1 Que.Queue

Module to manage a Queue comprising of multiple jobs.

Responsible for queueing (duh), executing and handling callbacks, for Que.Jobs of a specific Que.Worker. Also keeps track of running jobs and processes them concurrently (if the worker is configured so).

Meant for internal usage, so you shouldn’t use this unless you absolutely know what you’re doing.

Summary

Types

t()

A Que.Queue struct

Functions

Finds the Job in Queue by the specified key name and value

Returns a new processable Queue with defaults

Pops the next Job in queue and returns a queue and Job tuple

Processes the Queue and runs pending jobs

Pushes one or more Jobs to the queued list

Removes the specified Job from running

Finds a Job in the Queue by the given Job’s id, replaces it and returns an updated Queue

Types

t()
t() :: %Que.Queue{queued: term, running: term, worker: term}

A Que.Queue struct

Functions

find(queue, key \\ :id, value)
find(queue :: Que.Queue.t, key :: atom, value :: term) ::
  Que.Job.t |
  nil

Finds the Job in Queue by the specified key name and value.

If no key is specified, it’s assumed to be an :id. If the specified key is a :ref, it only searches in the :running list.

new(worker, jobs \\ [])
new(worker :: Que.Worker.t, jobs :: [Que.Job.t]) :: Que.Queue.t

Returns a new processable Queue with defaults

pop(q)
pop(queue :: Que.Queue.t) :: {Que.Queue.t, Que.Job.t | nil}

Pops the next Job in queue and returns a queue and Job tuple

process(q)
process(queue :: Que.Queue.t) :: Que.Queue.t

Processes the Queue and runs pending jobs

push(q, jobs)
push(queue :: Que.Queue.t, jobs :: Que.Job.t | [Que.Job.t]) :: Que.Queue.t

Pushes one or more Jobs to the queued list

remove(q, job)
remove(queue :: Que.Queue.t, job :: Que.Job.t) :: Que.Queue.t

Removes the specified Job from running

update(q, job)
update(queue :: Que.Queue.t, job :: Que.Job.t) :: Que.Queue.t

Finds a Job in the Queue by the given Job’s id, replaces it and returns an updated Queue