Skip to content

Commit

Permalink
BUGFIX: Return null on timeout
Browse files Browse the repository at this point in the history
Resolves #18
  • Loading branch information
paxuclus committed Mar 14, 2022
1 parent aa51589 commit 9f30211
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Queue/RabbitQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Neos\Utility\ObjectAccess;
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Exception\AMQPTimeoutException;
use PhpAmqpLib\Message\AMQPMessage;
use PhpAmqpLib\Wire\AMQPTable;

Expand Down Expand Up @@ -325,7 +326,11 @@ protected function dequeue(bool $ack = true, ?int $timeout = null): ?Message
});

while ($cache === null) {
$this->channel->wait(null, false, $timeout ?: 0);
try {
$this->channel->wait(null, false, $timeout ?: 0);
} catch (AMQPTimeoutException $e) {
return null;
}
}

$this->channel->basic_cancel($consumerTag);
Expand Down

0 comments on commit 9f30211

Please sign in to comment.