laravel-queue-rabbitmq icon indicating copy to clipboard operation
laravel-queue-rabbitmq copied to clipboard

Worker ignores `illuminate:queue:restart` signal

Open frans-beech-it opened this issue 4 years ago • 1 comments

  • Laravel version: 8.26.1
  • RabbitMQ version: 3
  • Package version: 11.1.1

Describe the bug

After calling queue:restart the worker doesn't stop.

Steps To Reproduce

  1. Run php artisan rabbitmq:consume
  2. Run in different terminal php artisan queue:restart

Current behavior

Worker ignores restart signal

Expected behavior

Worker should stop when stopIfNecessary() returns a exit code

Additional context

on https://github.com/vyuldashev/laravel-queue-rabbitmq/blob/master/src/Consumer.php#L142 now the stopIfNecessary() is called. But the exit code isn't handled. It should break from the while loop and stop the "deamon"

$this->stopIfNecessary($options, $lastRestart, $this->gotJob ? true : null);

should be changed to:

            $status = $this->stopIfNecessary(
                $options, $lastRestart, $startTime, $jobsProcessed, $job
            );

            if (! is_null($status)) {
                return $this->stop($status);
            }

frans-beech-it avatar Feb 24 '21 15:02 frans-beech-it

@vyuldashev same problem. We use systemd for workers, and systemd just killing the process with timeout exception on trying to restart service.

MorrisonHotel avatar Mar 01 '21 10:03 MorrisonHotel

Version 11 of this package is no longer supported. If you are still experiencing the issue with a more recent version, please open a separate issue.

khepin avatar Feb 04 '23 00:02 khepin