From 3245c523c7294d3e87f74a97bd6a132135550f1e Mon Sep 17 00:00:00 2001 From: "chris.boulton" Date: Sun, 27 Mar 2011 19:17:35 +1100 Subject: [PATCH] Add ability to fetch wildcarded list of queues a worker belongs to without it expanding them out using redis --- lib/Resque/Worker.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index aa834d5..a5c70b9 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -274,13 +274,15 @@ class Resque_Worker * when searching for jobs. * * 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. */ - public function queues() + public function queues($fetch = true) { - if(!in_array('*', $this->queues)) { + if(!in_array('*', $this->queues) || $fetch == false) { return $this->queues; } @@ -317,7 +319,7 @@ class Resque_Worker { $this->registerSigHandlers(); $this->pruneDeadWorkers(); - Resque_Event::trigger('beforeFirstFork'); + Resque_Event::trigger('beforeFirstFork', $this); $this->registerWorker(); }