Que v0.10.0 Que.Queue View Source
Module to manage a Queue comprising of multiple jobs.
Responsible for queueing (duh), executing and handling callbacks,
for Que.Job
s 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.
Link to this section Summary
Functions
Fetches the next Job in queue and returns a queue and Job tuple
Finds the Job in Queue by the specified key name and value.
Returns a new processable Queue with defaults
Processes the Queue and runs pending jobs
Adds one or more Jobs to the queued
list
Returns queued jobs in the Queue
Removes the specified Job from running
Returns running jobs in the Queue
Finds a Job in the Queue by the given Job's id, replaces it and returns an updated Queue
Link to this section Types
A Que.Queue
struct
Link to this section Functions
fetch(q)
View Source
fetch(queue :: Que.Queue.t()) :: {Que.Queue.t(), Que.Job.t() | nil}
fetch(queue :: Que.Queue.t()) :: {Que.Queue.t(), Que.Job.t() | nil}
Fetches the next Job in queue and returns a queue and Job tuple
find(queue, key \\ :id, value)
View Source
find(queue :: Que.Queue.t(), key :: atom(), value :: term()) ::
Que.Job.t() | nil
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 \\ [])
View Source
new(worker :: Que.Worker.t(), jobs :: [Que.Job.t()]) :: Que.Queue.t()
new(worker :: Que.Worker.t(), jobs :: [Que.Job.t()]) :: Que.Queue.t()
Returns a new processable Queue with defaults
process(q)
View Source
process(queue :: Que.Queue.t()) :: Que.Queue.t()
process(queue :: Que.Queue.t()) :: Que.Queue.t()
Processes the Queue and runs pending jobs
put(q, jobs)
View Source
put(queue :: Que.Queue.t(), jobs :: Que.Job.t() | [Que.Job.t()]) ::
Que.Queue.t()
put(queue :: Que.Queue.t(), jobs :: Que.Job.t() | [Que.Job.t()]) :: Que.Queue.t()
Adds one or more Jobs to the queued
list
queued(queue)
View Source
queued(queue :: Que.Queue.t()) :: [Que.Job.t()]
queued(queue :: Que.Queue.t()) :: [Que.Job.t()]
Returns queued jobs in the Queue
remove(q, job)
View Source
remove(queue :: Que.Queue.t(), job :: Que.Job.t()) :: Que.Queue.t()
remove(queue :: Que.Queue.t(), job :: Que.Job.t()) :: Que.Queue.t()
Removes the specified Job from running
running(queue)
View Source
running(queue :: Que.Queue.t()) :: [Que.Job.t()]
running(queue :: Que.Queue.t()) :: [Que.Job.t()]
Returns running jobs in the Queue
update(q, job)
View Source
update(queue :: Que.Queue.t(), job :: Que.Job.t()) :: Que.Queue.t()
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