From 164170ac967601a3b26939745206f01f661e2434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gamez?= Date: Tue, 3 Jan 2023 12:27:48 +0100 Subject: [PATCH] Fix method declaration compatibility (#499) Issue: https://github.com/vyuldashev/laravel-queue-rabbitmq/issues/499 Fix from: https://github.com/vyuldashev/laravel-queue-rabbitmq/pull/502 --- src/Consumer.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Consumer.php b/src/Consumer.php index 54438097..8b28f6c1 100644 --- a/src/Consumer.php +++ b/src/Consumer.php @@ -88,7 +88,7 @@ public function daemon($connectionName, $queue, WorkerOptions $options) $this->channel->basic_qos( $this->prefetchSize, $this->prefetchCount, - null + false ); $jobClass = $connection->getJobClass(); @@ -147,7 +147,7 @@ function (AMQPMessage $message) use ($connection, $options, $connectionName, $qu } catch (AMQPRuntimeException $exception) { $this->exceptions->report($exception); - $this->kill(1); + $this->kill(self::EXIT_ERROR); } catch (Exception|Throwable $exception) { $this->exceptions->report($exception); @@ -171,7 +171,7 @@ function (AMQPMessage $message) use ($connection, $options, $connectionName, $qu ); if (! is_null($status)) { - return $this->stop($status); + return $this->stop($status, $options); } $this->currentJob = null; @@ -195,14 +195,15 @@ protected function daemonShouldRun(WorkerOptions $options, $connectionName, $que * Stop listening and bail out of the script. * * @param int $status + * @param WorkerOptions|null $options * @return int */ - public function stop($status = 0): int + public function stop($status = 0, $options = null): int { // Tell the server you are going to stop consuming. // It will finish up the last message and not send you any more. $this->channel->basic_cancel($this->consumerTag, false, true); - return parent::stop($status); + return parent::stop($status, $options); } }