Merge branch 'master' of github.com:chrisboulton/php-resque

This commit is contained in:
Chris Boulton 2014-06-26 21:04:08 +10:00
commit f7e9e8b7b1

View File

@ -49,6 +49,36 @@ class Resque_Worker
*/ */
private $child = null; private $child = null;
/**
* Instantiate a new worker, given a list of queues that it should be working
* on. The list of queues should be supplied in the priority that they should
* be checked for jobs (first come, first served)
*
* Passing a single '*' allows the worker to work on all queues in alphabetical
* order. You can easily add new queues dynamically and have them worked on using
* this method.
*
* @param string|array $queues String with a single queue name, array with multiple.
*/
public function __construct($queues)
{
$this->logger = new Resque_Log();
if(!is_array($queues)) {
$queues = array($queues);
}
$this->queues = $queues;
if(function_exists('gethostname')) {
$hostname = gethostname();
}
else {
$hostname = php_uname('n');
}
$this->hostname = $hostname;
$this->id = $this->hostname . ':'.getmypid() . ':' . implode(',', $this->queues);
}
/** /**
* Return all workers known to Resque as instantiated instances. * Return all workers known to Resque as instantiated instances.
* @return array * @return array
@ -107,34 +137,6 @@ class Resque_Worker
$this->id = $workerId; $this->id = $workerId;
} }
/**
* Instantiate a new worker, given a list of queues that it should be working
* on. The list of queues should be supplied in the priority that they should
* be checked for jobs (first come, first served)
*
* Passing a single '*' allows the worker to work on all queues in alphabetical
* order. You can easily add new queues dynamically and have them worked on using
* this method.
*
* @param string|array $queues String with a single queue name, array with multiple.
*/
public function __construct($queues)
{
if(!is_array($queues)) {
$queues = array($queues);
}
$this->queues = $queues;
if(function_exists('gethostname')) {
$hostname = gethostname();
}
else {
$hostname = php_uname('n');
}
$this->hostname = $hostname;
$this->id = $this->hostname . ':'.getmypid() . ':' . implode(',', $this->queues);
}
/** /**
* The primary loop for a worker which when called on an instance starts * The primary loop for a worker which when called on an instance starts
* the worker's life cycle. * the worker's life cycle.