Skip to content

Commit

Permalink
Fix method declaration compatibility (vyuldashev#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Jan 3, 2023
1 parent e15f988 commit 164170a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function daemon($connectionName, $queue, WorkerOptions $options)
$this->channel->basic_qos(
$this->prefetchSize,
$this->prefetchCount,
null
false
);

$jobClass = $connection->getJobClass();
Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand All @@ -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);
}
}

0 comments on commit 164170a

Please sign in to comment.