Skip to content

Commit

Permalink
Merge pull request #27492 from crynobone/pheanstalk-4
Browse files Browse the repository at this point in the history
[5.8] Update to pda/pheanstalk ^4.0
  • Loading branch information
taylorotwell authored Feb 12, 2019
2 parents 79bc7bb + 292bcd7 commit bacca09
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"mockery/mockery": "^1.0",
"moontoast/math": "^1.1",
"orchestra/testbench-core": "3.8.*",
"pda/pheanstalk": "^3.0",
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^7.5|^8.0",
"predis/predis": "^1.1.1",
"symfony/css-selector": "^4.2",
Expand Down Expand Up @@ -128,7 +128,7 @@
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",
"moontoast/math": "Required to use ordered UUIDs (^1.1).",
"nexmo/client": "Required to use the Nexmo transport (^1.0).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^3.0).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"predis/predis": "Required to use the redis cache and queue drivers (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^3.0).",
"symfony/css-selector": "Required to use some of the crawler integration testing tools (^4.2).",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/BeanstalkdQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function pop($queue = null)
{
$queue = $this->getQueue($queue);

$job = $this->pheanstalk->watchOnly($queue)->reserve($this->blockFor);
$job = $this->pheanstalk->watchOnly($queue)->reserveWithTimeout($this->blockFor);

if ($job instanceof PheanstalkJob) {
return new BeanstalkdJob(
Expand Down
5 changes: 2 additions & 3 deletions src/Illuminate/Queue/Connectors/BeanstalkdConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ public function connect(array $config)
*/
protected function pheanstalk(array $config)
{
return new Pheanstalk(
return Pheanstalk::connect(
$config['host'],
$config['port'] ?? Pheanstalk::DEFAULT_PORT,
$config['timeout'] ?? Connection::DEFAULT_CONNECT_TIMEOUT,
$config['persistent'] ?? false
$config['timeout'] ?? Connection::DEFAULT_CONNECT_TIMEOUT
);
}
}
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ext-posix": "Required to use all features of the queue worker.",
"aws/aws-sdk-php": "Required to use the SQS queue driver (^3.0).",
"illuminate/redis": "Required to use the Redis queue driver (5.8.*).",
"pda/pheanstalk": "Required to use the Beanstalk queue driver (^3.0)."
"pda/pheanstalk": "Required to use the Beanstalk queue driver (^4.0)."
},
"config": {
"sort-packages": true
Expand Down
4 changes: 2 additions & 2 deletions tests/Queue/QueueBeanstalkdQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testPopProperlyPopsJobOffOfBeanstalkd()
$pheanstalk = $queue->getPheanstalk();
$pheanstalk->shouldReceive('watchOnly')->once()->with('default')->andReturn($pheanstalk);
$job = m::mock(Job::class);
$pheanstalk->shouldReceive('reserve')->once()->with(0)->andReturn($job);
$pheanstalk->shouldReceive('reserveWithTimeout')->once()->with(0)->andReturn($job);

$result = $queue->pop();

Expand All @@ -62,7 +62,7 @@ public function testBlockingPopProperlyPopsJobOffOfBeanstalkd()
$pheanstalk = $queue->getPheanstalk();
$pheanstalk->shouldReceive('watchOnly')->once()->with('default')->andReturn($pheanstalk);
$job = m::mock(Job::class);
$pheanstalk->shouldReceive('reserve')->once()->with(60)->andReturn($job);
$pheanstalk->shouldReceive('reserveWithTimeout')->once()->with(60)->andReturn($job);

$result = $queue->pop();

Expand Down

0 comments on commit bacca09

Please sign in to comment.