-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Horizon restarting but old code is being used #415
Comments
Did you adapt this line in your code to use 3 args? |
@mfn That's the thing, I'm using |
Can you try upgrading to the latest Horizon version? Can you try switching the purge and terminate commands? |
@driesvints I'm using the latest version. I've added purge to the deploy process now (I was already using terminate). |
Maybe see #213 for the correct commands and order to use when deploying. |
Hmm... I also have the similar issue, but on my end it is related to the emails. Basically, the app is using a default css theme instead of the updated one, but not always... I'm using the latest version of Horizon and the list of commands I run on deploy are the following (as suggested in #213 ):
So, after I deploy and test things, it is using a new css theme that I've created and everything is working as it should. However, from time to time I get the same email but with old css theme, which makes things even more weird. It's like there is a process that is still running the old code or something... I haven't tried to reboot the server since it is a production machine, but I'll guess I'll have to try that and see if it will solve the issue. If someone has an idea what can be the issue and how to fix it, please let me know. |
For those who are interested, here is what was the issue on my end and how I solved it. So, as described above, I had an issue with email templates. The way my app was set up is the following:
After a lot of testing, I figured out that the problem only occurs after an email that uses other.css theme is sent. After such email, all other emails will use the other.css theme instead of a default.css, as it is specified inside the config file. The solution I had for this issue is to add a dedicated Mailable class for each email, instead of building an email from the I'm not sure why this happens but hopefully it will help someone with a similar problem. |
That sounds a lot like the class gets only instantiated once and this instance is then subsequently re-used. Horizons (or for that matter, Laravels) worker don't restarted per se which means any class you use which might be "cached" somewhere (Facades, Singletons) are only created once and never again (until the service/worker restarts). (for example: there or other Background job solutions for PHP which always fork a new worker process => that kind of architecture will not suffer this problem) The benefit is increased overall performance because the framework is only bootstrapped once per worker and usually there's nothing which changes (unless you deploy, in which case you need to trigger the restart). That said, this can catch especially PHP developers off guard which usually aren't used to this "longevity" of processes/classes/code and requires sometimes a different way of thinking how to solve things. Btw, from your description it does not sound like you suffered the issues title problem ("Horizon restarting but old code is being used") and I think your explanation is clear that it's another matter (for which you found the correct solution, I believe). |
Of course @mfn, it is pretty clear that the issue is not what the title says as I thought initially, and since I already posted a comment about the issue, I added another comment for anyone with the similar issue. |
@Braunson |
@KevinHN I tried this and it didn’t work. Put everything on a new server and no more issues |
One thing I do to check for old horizon processes is this command. It prints all the horizon processes sorted descending by start time. Kill the old ones and see if the error happens again.
I think there has been some bug-fixes in the recent horizon versions that fixed this issue. |
This should be open, start all in a new server sometimes is not an option. |
On deploy we are restarting PHP-FPM and running..
However jobs are failing due to using old code, in one example it's using
Auth::loginUsingId(1)
but is throwing an error as it expects 3 params but receiving two. This was a change from Laravel 5.6 -> 5.7. For some reason it's using old code.Error:
Looks like Illuminate/Auth/Events/Login
__construct
expects three params in 5.7 but is receiving two (missing the$guard
).Full Stack
The text was updated successfully, but these errors were encountered: