View Source OddJob.Queue (OddJob v0.5.1)
The OddJob.Queue
is a GenServer
that manages the assignments given to the pool workers.
The queue
receives jobs and assigns them to available workers. If all workers in a pool are
currently busy then new jobs are added to a FIFO queue to be processed as workers
become available.
Link to this section Summary
Link to this section Types
Specs
job() :: OddJob.Job.t()
Specs
queue() :: {:via, Registry, {OddJob.Registry, {atom(), :queue}}}
Specs
The OddJob.Queue
struct holds the state of the job queue.
:pool
is a term representing the name of the job pool that thequeue
belongs to:workers
is a list of the active workerpid
s, whether they are busy working or not:assigned
is a list of the workerpid
s that are currently assigned to a job:jobs
is a list ofOddJob.Job
structs representing the jobs that are queued to be performed when workers are available
Specs
worker() :: pid()