diff --git a/src/Illuminate/Queue/BeanstalkdQueue.php b/src/Illuminate/Queue/BeanstalkdQueue.php index d6b0761d4c1..24dc9c0b4f8 100755 --- a/src/Illuminate/Queue/BeanstalkdQueue.php +++ b/src/Illuminate/Queue/BeanstalkdQueue.php @@ -148,7 +148,7 @@ public function deleteMessage($queue, $id) */ public function getQueue($queue) { - return $this->getQueuePrefix().($queue ?: $this->default); + return $queue ?: $this->default; } /** diff --git a/src/Illuminate/Queue/DatabaseQueue.php b/src/Illuminate/Queue/DatabaseQueue.php index 59f58a75473..51a30a7df78 100644 --- a/src/Illuminate/Queue/DatabaseQueue.php +++ b/src/Illuminate/Queue/DatabaseQueue.php @@ -208,7 +208,7 @@ protected function getNextAvailableJob($queue) { $job = $this->database->table($this->table) ->lockForUpdate() - ->where('queue', $queue) + ->where('queue', $this->getQueue($queue)) ->where(function ($query) { $this->isAvailable($query); $this->isReservedButExpired($query); @@ -308,7 +308,7 @@ public function deleteReserved($queue, $id) */ protected function getQueue($queue) { - return $this->getQueuePrefix().($queue ?: $this->default); + return $queue ?: $this->default; } /** diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index fdccfc78db4..c53dcf35539 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -29,13 +29,6 @@ abstract class Queue */ protected $connectionName; - /** - * The queue prefix. - * - * @var string - */ - protected $queuePrefix; - /** * Push a new job onto the queue. * @@ -185,29 +178,6 @@ public function setConnectionName($name) return $this; } - /** - * Set the queue name prefix. - * - * @param string $prefix - * @return $this - */ - public function setQueuePrefix($prefix = null) - { - $this->queuePrefix = $prefix; - - return $this; - } - - /** - * Get the queue name prefix. - * - * @return string - */ - public function getQueuePrefix() - { - return $this->queuePrefix; - } - /** * Set the IoC container instance. * diff --git a/src/Illuminate/Queue/QueueManager.php b/src/Illuminate/Queue/QueueManager.php index d86ce6a4e50..b8fcb3c91b0 100755 --- a/src/Illuminate/Queue/QueueManager.php +++ b/src/Illuminate/Queue/QueueManager.php @@ -152,8 +152,7 @@ protected function resolve($name) return $this->getConnector($config['driver']) ->connect($config) - ->setConnectionName($name) - ->setQueuePrefix($this->getQueuePrefix()); + ->setConnectionName($name); } /** @@ -244,16 +243,6 @@ public function getName($connection = null) return $connection ?: $this->getDefaultDriver(); } - /** - * Get the queue name prefix. - * - * @return string - */ - public function getQueuePrefix() - { - return $this->app['config']->get('queue.prefix'); - } - /** * Determine if the application is in maintenance mode. * diff --git a/src/Illuminate/Queue/RedisQueue.php b/src/Illuminate/Queue/RedisQueue.php index 6cb489b1e4d..9dad2419fdf 100644 --- a/src/Illuminate/Queue/RedisQueue.php +++ b/src/Illuminate/Queue/RedisQueue.php @@ -256,7 +256,7 @@ protected function getRandomId() */ protected function getQueue($queue) { - return 'queues:'.$this->getQueuePrefix().($queue ?: $this->default); + return 'queues:'.($queue ?: $this->default); } /** diff --git a/src/Illuminate/Queue/SqsQueue.php b/src/Illuminate/Queue/SqsQueue.php index 8388fd21606..dc85d9771a6 100755 --- a/src/Illuminate/Queue/SqsQueue.php +++ b/src/Illuminate/Queue/SqsQueue.php @@ -137,7 +137,7 @@ public function pop($queue = null) */ public function getQueue($queue) { - $queue = $this->getQueuePrefix().($queue ?: $this->default); + $queue = $queue ?: $this->default; return filter_var($queue, FILTER_VALIDATE_URL) === false ? rtrim($this->prefix, '/').'/'.$queue : $queue; diff --git a/tests/Queue/QueueManagerTest.php b/tests/Queue/QueueManagerTest.php index 6cd35ecb532..d5b08b0e590 100755 --- a/tests/Queue/QueueManagerTest.php +++ b/tests/Queue/QueueManagerTest.php @@ -16,13 +16,11 @@ public function tearDown() public function testDefaultConnectionCanBeResolved() { - $config = new Repository([ - 'queue.default' => 'sync', - 'queue.connections.sync' => ['driver' => 'sync'], - ]); - $app = [ - 'config' => $config, + 'config' => [ + 'queue.default' => 'sync', + 'queue.connections.sync' => ['driver' => 'sync'], + ], 'encrypter' => $encrypter = m::mock('Illuminate\Contracts\Encryption\Encrypter'), ]; @@ -30,25 +28,22 @@ public function testDefaultConnectionCanBeResolved() $connector = m::mock('StdClass'); $queue = m::mock('StdClass'); $queue->shouldReceive('setConnectionName')->once()->with('sync')->andReturnSelf(); - $queue->shouldReceive('setQueuePrefix')->once()->with('')->andReturnSelf(); $connector->shouldReceive('connect')->once()->with(['driver' => 'sync'])->andReturn($queue); $manager->addConnector('sync', function () use ($connector) { return $connector; }); - $queue->shouldReceive('setContainer')->once()->with($app); + $queue->shouldReceive('setContainer')->once()->with($app); $this->assertSame($queue, $manager->connection('sync')); } public function testOtherConnectionCanBeResolved() { - $config = new Repository([ - 'queue.default' => 'sync', - 'queue.connections.foo' => ['driver' => 'bar'], - ]); - $app = [ - 'config' => $config, + 'config' => [ + 'queue.default' => 'sync', + 'queue.connections.foo' => ['driver' => 'bar'], + ], 'encrypter' => $encrypter = m::mock('Illuminate\Contracts\Encryption\Encrypter'), ]; @@ -56,7 +51,6 @@ public function testOtherConnectionCanBeResolved() $connector = m::mock('StdClass'); $queue = m::mock('StdClass'); $queue->shouldReceive('setConnectionName')->once()->with('foo')->andReturnSelf(); - $queue->shouldReceive('setQueuePrefix')->once()->with('')->andReturnSelf(); $connector->shouldReceive('connect')->once()->with(['driver' => 'bar'])->andReturn($queue); $manager->addConnector('bar', function () use ($connector) { return $connector; @@ -68,12 +62,10 @@ public function testOtherConnectionCanBeResolved() public function testNullConnectionCanBeResolved() { - $config = new Repository([ - 'queue.default' => 'null', - ]); - $app = [ - 'config' => $config, + 'config' => [ + 'queue.default' => 'null', + ], 'encrypter' => $encrypter = m::mock('Illuminate\Contracts\Encryption\Encrypter'), ]; @@ -81,7 +73,6 @@ public function testNullConnectionCanBeResolved() $connector = m::mock('StdClass'); $queue = m::mock('StdClass'); $queue->shouldReceive('setConnectionName')->once()->with('null')->andReturnSelf(); - $queue->shouldReceive('setQueuePrefix')->once()->with('')->andReturnSelf(); $connector->shouldReceive('connect')->once()->with(['driver' => 'null'])->andReturn($queue); $manager->addConnector('null', function () use ($connector) { return $connector;