Skip to content

Commit 3162bfb

Browse files
SamMousasamdark
authored andcommitted
Fixes yiisoft#248: Reduce roundtrips to beanstalk server when removing job
1 parent cbe860e commit 3162bfb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ Yii2 Queue Extension Change Log
44
2.1.1 under development
55
-----------------------
66

7-
- no changes in this release.
8-
7+
- Enh #248: Reduce roundtrips to beanstalk server when removing job (SamMousa)
98

109
2.1.0 May 24, 2018
1110
------------------

src/drivers/beanstalk/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace yii\queue\beanstalk;
99

1010
use Pheanstalk\Exception\ServerException;
11+
use Pheanstalk\Job;
1112
use Pheanstalk\Pheanstalk;
1213
use Pheanstalk\PheanstalkInterface;
1314
use yii\base\InvalidArgumentException;
@@ -103,8 +104,7 @@ public function status($id)
103104
public function remove($id)
104105
{
105106
try {
106-
$job = $this->getPheanstalk()->peek($id);
107-
$this->getPheanstalk()->delete($job);
107+
$this->getPheanstalk()->delete(new Job($id, null));
108108
return true;
109109
} catch (ServerException $e) {
110110
if (strpos($e->getMessage(), 'NOT_FOUND') === 0) {

0 commit comments

Comments
 (0)