Skip to content

Commit 3245c52

Browse files
author
chris.boulton
committed
Add ability to fetch wildcarded list of queues a worker belongs to without it expanding them out using redis
1 parent 6f43fcf commit 3245c52

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Resque/Worker.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,15 @@ public function reserve()
274274
* when searching for jobs.
275275
*
276276
* If * is found in the list of queues, every queue will be searched in
277-
* alphabetic order.
277+
* alphabetic order. (@see $fetch)
278278
*
279+
* @param boolean $fetch If true, and the queue is set to *, will fetch
280+
* all queue names from redis.
279281
* @return array Array of associated queues.
280282
*/
281-
public function queues()
283+
public function queues($fetch = true)
282284
{
283-
if(!in_array('*', $this->queues)) {
285+
if(!in_array('*', $this->queues) || $fetch == false) {
284286
return $this->queues;
285287
}
286288

@@ -317,7 +319,7 @@ private function startup()
317319
{
318320
$this->registerSigHandlers();
319321
$this->pruneDeadWorkers();
320-
Resque_Event::trigger('beforeFirstFork');
322+
Resque_Event::trigger('beforeFirstFork', $this);
321323
$this->registerWorker();
322324
}
323325

0 commit comments

Comments
 (0)