-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Fix Octane Event using handle instead of asListener #235
Fix Octane Event using handle instead of asListener #235
Conversation
Hi there, thank you for that! 🍺 I'm happy to merge this as a minor bump despite the niche breaking change. However, it looks like some tests are failing in the PR for some environments. Would you mind investigating? |
@lorisleiva these failing tests are not caused by this change but rather by a fix made in a newer version of laravel 9.x/10.x. I have created a separate PR with the test fix here: #237 |
Whilst running this change in production, it works 99% of the time, yet we have seen this error still occur 4 times in 8 days all on the same
I will deploy this updated change to our test environments in the next week, and production will probably be a couple weeks. If you prefer, I can split this specific part of the fix into a seperate PR, I look forward to your feedback. |
Awesome, thanks for that! Could you please pull the latest changes from main? I have fixed the tests caused by the latest version of Laravel and also dropped support for Laravel 8 altogether since that's now 2 major versions behind. |
@lorisleiva I have rebased the PR from the latest main branch. 👍 |
You should probably add PHP 8.2 to the github actions test matrix. |
Thanks! Would you be able to tell me if that PR now fixes your production app 100% of the time so we know for sure it works before releasing?
It doesn't look like the |
I won't have this newest version of this fix on production for a couple weeks once it has gone through testing. Feel free to hold off merging until then.
Laravel does support 8.2 all our laravel apps are running on PHP 8.2 and their |
My bad, I misread the Yeah let's do that, just ping me whenever it's working in production and I'll merge/release. Thank you! 🍺 |
@lorisleiva I'm sorry I completely forgot to come back and let you know if the issue was resolved. 🤣 I am happy to report that this PR is working perfectly in production for a couple weeks and we have had no occurrences of this error since. What I will say is that we are only using |
Thanks! Let's merge that in. |
* Fix lorisleiva#136 Octane Event use handle instead of asListener * Create the ActionManager as a scoped singleton instance
Fixes #136
This PR seems to fix the issue when using listeners with an application running on Octane where it calls
handle
instead of theasListener
method.We encountered this issue on listeners that were not queued (i.e. not implementing
ShouldQueue
).Cause
After some lengthy debugging, it seemed that the
app()->extend(..
callback inActionManager::extend
method was not actually getting called once the listener was resolved when running on Octane. So I tried to figure out which container instance it should be using.Fix
Basically reverted the changes made originally here a2e42f0 as it seems in this case it is correct to use the
Application
instance passed to thebeforeResolving
callback to extend the found action classes.This seemed to fix the issue for me when running Octane locally. We deployed this fork to our prod environments too (on Vapor) and it works without issue.
Possible Breaking Changes
I have had to change the method signature of
ActionManager::extend
to accept anApplication $app
argument.Let me know if you can come up with a change that would not require changing this method signature.
Anyone who has done a workaround to this issue by defining their event listeners like:
UserEvent::class => [ [UserAction::class, 'asListener'] ]
They will get an error after this fix of
Unknown method ListenerDecorator::asListener
and will need to change these back to: