laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.88k stars 659 forks source link

Complete restart of workers when using `horizon:terminate` cmd #1325

Closed ChristopheBorcard closed 1 year ago

ChristopheBorcard commented 1 year ago

Horizon Version

5.21.1

Laravel Version

10.4

PHP Version

8.2

Redis Driver

PhpRedis

Redis Version

5

Database Driver & Version

No response

Description

I don't understand why a full worker restart is requested when using the horizon:terminate command.

You can see this line Here

$this->laravel['cache']->forever('illuminate:queue:restart', $this->currentTime());

I use Laravel Horizon in Kubernetes with HPA, which allows me to have several worker Pods. But during a scalldown or rollout update, all workers in all pods are restarted.

I had to create my own terminate command to remove the queue:restart cache insertion but I was wondering if it really had a purpose or if it could be removed directly from the package.

Steps To Reproduce

Start several Horizon using the same redis and terminate one of them. Workers in other Horizon will also quit and restart.

driesvints commented 1 year ago

Right now, we don't support running multiple Horizon instances on the same redis connection, sorry.