diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index d08504c..379b853 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -49,9 +49,34 @@ class Resque_Worker */ private $child = null; - public function __construct() + /** + * 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); } /** @@ -112,34 +137,6 @@ class Resque_Worker $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 worker's life cycle.