Fix queue name prefixing

This commit is contained in:
Holger Reinhardt 2016-07-29 15:23:33 +02:00
parent fd166bbe82
commit 175123695d
2 changed files with 8 additions and 8 deletions

View File

@ -76,9 +76,9 @@ class WorkCommand extends IlluminateCommand
*/ */
private function startWorker(array $queues, $interval = 5, $logLevel = Resque_Worker::LOG_NONE) private function startWorker(array $queues, $interval = 5, $logLevel = Resque_Worker::LOG_NONE)
{ {
$queues = array_walk($queues, function ($queue) { $queues = array_map(function ($queue) {
return $this->manager->getQueue($queue); return $this->manager->getQueueName($queue);
}); }, $queues);
$worker = new Resque_Worker($queues); $worker = new Resque_Worker($queues);
$worker->logLevel = $logLevel; $worker->logLevel = $logLevel;

View File

@ -48,7 +48,7 @@ class ResqueManager
*/ */
public function enqueue(Job $job, $trackStatus = false) 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) { if (true === $trackStatus) {
return new \Resque_Job_Status($id); return new \Resque_Job_Status($id);
@ -65,7 +65,7 @@ class ResqueManager
*/ */
public function enqueueOnce(Job $job, $trackStatus = false) public function enqueueOnce(Job $job, $trackStatus = false)
{ {
$queue = new Queue($this->getQueueFromJob($job)); $queue = new Queue($this->getQueueNameFromJob($job));
foreach ($queue->jobs() as $queuedJob) { foreach ($queue->jobs() as $queuedJob) {
if (true === $this->isDuplicateJob($job, $queuedJob)) { if (true === $this->isDuplicateJob($job, $queuedJob)) {
@ -115,11 +115,11 @@ class ResqueManager
&& count(array_intersect($queuedJob->getArguments(), $job->arguments())) === count($job->arguments()); && count(array_intersect($queuedJob->getArguments(), $job->arguments())) === count($job->arguments());
} }
private function getQueueFromJob(Job $job) private function getQueueNameFromJob(Job $job)
{ {
$queue = $job->queue(); $queue = $job->queue();
return $this->getQueue($queue); return $this->getQueueName($queue);
} }
/** /**
@ -127,7 +127,7 @@ class ResqueManager
* *
* @return string * @return string
*/ */
public function getQueue($queue) public function getQueueName($queue)
{ {
if ($this->queuePrefix) { if ($this->queuePrefix) {
$queue = implode(':', [$this->queuePrefix, $queue]); $queue = implode(':', [$this->queuePrefix, $queue]);