Add ability to fetch wildcarded list of queues a worker belongs to without it expanding them out using redis

This commit is contained in:
chris.boulton 2011-03-27 19:17:35 +11:00
parent 6f43fcfed8
commit 3245c523c7

View File

@ -274,13 +274,15 @@ class Resque_Worker
* when searching for jobs. * when searching for jobs.
* *
* If * is found in the list of queues, every queue will be searched in * If * is found in the list of queues, every queue will be searched in
* alphabetic order. * alphabetic order. (@see $fetch)
* *
* @param boolean $fetch If true, and the queue is set to *, will fetch
* all queue names from redis.
* @return array Array of associated queues. * @return array Array of associated queues.
*/ */
public function queues() public function queues($fetch = true)
{ {
if(!in_array('*', $this->queues)) { if(!in_array('*', $this->queues) || $fetch == false) {
return $this->queues; return $this->queues;
} }
@ -317,7 +319,7 @@ class Resque_Worker
{ {
$this->registerSigHandlers(); $this->registerSigHandlers();
$this->pruneDeadWorkers(); $this->pruneDeadWorkers();
Resque_Event::trigger('beforeFirstFork'); Resque_Event::trigger('beforeFirstFork', $this);
$this->registerWorker(); $this->registerWorker();
} }