Incorrect status on duplicate worker
Horizon Version
5.24.5
Laravel Version
10.48.12
PHP Version
8.3.1
Redis Driver
Predis
Redis Version
2.2.2
Database Driver & Version
No response
Description
A bit of an edge-case here, but I have duplicate workers that spin up which have the same configuration - supervisor and horizon.
I noticed that if I run horizon:pause on worker-1, then spin up a new worker (worker-2) horizon:status still says "Paused". However, the Horizon web dashboard correct shows the "play" icon for worker-2 and "paused" icon for worker-1.
I'm glad to dig into the code, but don't have time now. So I wanted to get this tracked somewhere. My guess is the logic the horizon:status command uses to check status is not the same as the logic the web dashboard uses.
I've attached some screenshots for a visual diff of the issue where the web dashboard show the status correctly, but CLI does not.
Horizon Dashboard
CLI
Steps To Reproduce
- Start two identical workers with the same supervisor and horizon config
- Run
horizon:pauseon one - Start the other worker
- Run
horizon:statuson the other
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
The horizon:list command checks all registered supervisors, and if just one has a "paused" status it outputs "Horizon is paused". What would be the preferred output here @jasonmccreary? A table similar to the dashboard?
@mfrieswyk, I would expect if I am on the worker and run horizon:status it would show the current status for that worker.
In lieu of that, then yeah, a list of all worker statuses would be better, imo, than saying "paused" when the current worker is not the one that is paused.
@jasonmccreary I went ahead and made this PR to address this issue. It's not a full list of all worker statuses because I felt like changing the behavior of the main status command might be a bit much. Instead I made a new command in the style of the pause/continue commands that requires a name of the supervisor you would like the status for. Hope this helps.
@mfrieswyk do you have time to answer Taylor's question on that PR?
I'm going to close this one for now since it's been a while. Would still love to receive a working PR or work being picked up on the PR above. Thanks
@driesvints sorry for the delay, pushed updates to the PR