diff --git a/src/Console/WorkCommand.php b/src/Console/WorkCommand.php index 325ba38..86ab95c 100644 --- a/src/Console/WorkCommand.php +++ b/src/Console/WorkCommand.php @@ -76,9 +76,9 @@ class WorkCommand extends IlluminateCommand */ private function startWorker(array $queues, $interval = 5, $logLevel = Resque_Worker::LOG_NONE) { - $queues = array_walk($queues, function ($queue) { - return $this->manager->getQueue($queue); - }); + $queues = array_map(function ($queue) { + return $this->manager->getQueueName($queue); + }, $queues); $worker = new Resque_Worker($queues); $worker->logLevel = $logLevel; diff --git a/src/ResqueManager.php b/src/ResqueManager.php index a54af90..36cb59d 100644 --- a/src/ResqueManager.php +++ b/src/ResqueManager.php @@ -48,7 +48,7 @@ class ResqueManager */ public function enqueue(Job $job, $trackStatus = false) { - $id = $this->resque->enqueue($this->getQueueFromJob($job), get_class($job), $job->arguments(), $trackStatus); + $id = $this->resque->enqueue($this->getQueueNameFromJob($job), get_class($job), $job->arguments(), $trackStatus); if (true === $trackStatus) { return new \Resque_Job_Status($id); @@ -65,7 +65,7 @@ class ResqueManager */ public function enqueueOnce(Job $job, $trackStatus = false) { - $queue = new Queue($this->getQueueFromJob($job)); + $queue = new Queue($this->getQueueNameFromJob($job)); foreach ($queue->jobs() as $queuedJob) { if (true === $this->isDuplicateJob($job, $queuedJob)) { @@ -115,11 +115,11 @@ class ResqueManager && count(array_intersect($queuedJob->getArguments(), $job->arguments())) === count($job->arguments()); } - private function getQueueFromJob(Job $job) + private function getQueueNameFromJob(Job $job) { $queue = $job->queue(); - return $this->getQueue($queue); + return $this->getQueueName($queue); } /** @@ -127,7 +127,7 @@ class ResqueManager * * @return string */ - public function getQueue($queue) + public function getQueueName($queue) { if ($this->queuePrefix) { $queue = implode(':', [$this->queuePrefix, $queue]);