It seems like the issue might be related to the number of processes you have configured in Supervisor. When you increase the number of processes, the jobs are being processed but none of them are finishing.
One possible reason for this could be that you have not properly configured your Redis connection for multiple processes. By default, Laravel's Redis queue driver uses the predis library, which does not support multiple processes out of the box.
To solve this issue, you can switch to using the phpredis extension, which does support multiple processes. Here are the steps to do that:
-
Install the
phpredisextension if you haven't already. You can find installation instructions in the official PHP documentation: https://www.php.net/manual/en/redis.installation.php -
Once the extension is installed, update your Laravel project's
config/queue.phpfile to use thephpredisdriver instead ofpredis. Change theredisdriver tophpredis:
'default' => env('QUEUE_CONNECTION', 'phpredis'),
- Update your Supervisor configuration to use the
phpcommand instead ofartisanto run the queue worker. For example, if your current Supervisor configuration looks like this:
command=php /path/to/artisan queue:work --tries=3 --daemon
Change it to:
command=php /path/to/artisan queue:work --driver=phpredis --tries=3 --daemon
Make sure to replace /path/to/artisan with the actual path to your artisan file.
- Restart Supervisor to apply the changes.
With these changes, your Laravel queue worker should now be able to process jobs correctly with multiple processes using Redis and Supervisor.