NAME
Minion::Worker - Minion worker
SYNOPSIS
use Minion::Worker;
my $worker = Minion::Worker->new(minion => $minion);
DESCRIPTION
Minion::Worker performs jobs for Minion.
ATTRIBUTES
Minion::Worker implements the following attributes.
id
my $oid = $worker->id;
$worker = $worker->id($oid);
Worker id.
minion
my $minion = $worker->minion;
$worker = $worker->minion(Minion->new);
Minion object this worker belongs to.
number
my $num = $worker->number;
$worker = $worker->number(5);
Number of this worker, unique per process.
METHODS
Minion::Worker inherits all methods from Mojo::Base and implements the following new ones.
all_jobs
my $num = $worker->all_jobs;
Perform jobs until queue is empty and return the number of jobs performed.
dequeue
my $job = $worker->dequeue;
Dequeue Minion::Job object and transition from inactive
to active
state or return undef
if queue was empty.
one_job
my $bool = $worker->one_job;
Perform one job and return a false value if queue was empty.
register
$worker = $worker->register;
Register worker.
repair
$worker = $worker->repair;
Repair worker registry and job queue.
unregister
$worker = $worker->unregister;
Unregister worker.