Skip to content

Commit 08d177a

Browse files
committed
1 parent 9308d90 commit 08d177a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [10.0.2 (2019-12-13)](https://github.com/vyuldashev/laravel-queue-rabbitmq/compare/v10.0.1...v10.0.2)
6+
7+
- Finally fix [#235](https://github.com/vyuldashev/laravel-queue-rabbitmq/issues/235)
8+
59
## [10.0.1 (2019-12-13)](https://github.com/vyuldashev/laravel-queue-rabbitmq/compare/v10.0.0...v10.0.1)
610

711
- Add missing container instance and connectionName to RabbitMQJob

src/Queue/RabbitMQQueue.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ class RabbitMQQueue extends Queue implements QueueContract
6060
*/
6161
protected $boundQueues = [];
6262

63+
/**
64+
* Current job being processed.
65+
*
66+
* @var RabbitMQJob
67+
*/
68+
protected $currentJob;
69+
6370
public function __construct(
6471
AbstractConnection $connection,
6572
string $default
@@ -198,7 +205,7 @@ public function pop($queue = null)
198205

199206
/** @var AMQPMessage|null $message */
200207
if ($message = $this->channel->basic_get($queue)) {
201-
return new RabbitMQJob(
208+
return $this->currentJob = new RabbitMQJob(
202209
$this->container,
203210
$this,
204211
$message,
@@ -398,6 +405,10 @@ protected function getRandomId(): string
398405
*/
399406
public function close(): void
400407
{
408+
if ($this->currentJob) {
409+
$this->reject($this->currentJob);
410+
}
411+
401412
$this->connection->close();
402413
}
403414
}

0 commit comments

Comments
 (0)