-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
An error occurs in the SubscriptionRegistry when sending a subscription event via Subscription::broadcast with Laravel Octane (Swoole) #2520
Comments
The error only appears when used together with laravel octane (swoole). There is no error when using php-fpm. |
Add dump to constuctor of SubscriptionRegistry dump('subscription registry new instance: ' . spl_object_hash($this)); Got 2 instances
First request i got
Second and future requests
In the second and etc requests, subscription registration is not called... |
To fix this issue just add Description of this configuration section. /*
|--------------------------------------------------------------------------
| Warm / Flush Bindings
|--------------------------------------------------------------------------
|
| The bindings listed below will either be pre-warmed when a worker boots
| or they will be flushed before every new request. Flushing a binding
| will force the container to resolve that binding again when asked.
|
*/ After adding this SubscriptionRegistry to the list of warms, the problem went away. 'warm' => [
...Octane::defaultServicesToWarm(),
Nuwave\Lighthouse\Subscriptions\SubscriptionRegistry::class,
], It is worth updating the documentation and creating a section on how to configure lighthouse to work with laravel octane, or using internal methods to change the laravel octane configuration. I'm still not entirely sure whether the decision is correct or whether there is some side effect from adding this class to the list of "warm". |
Based on the explanations in this article, this appears to be a solution to the problem. https://divinglaravel.com/laravel-octane-bootstrapping-the-application-and-handling-requests
But the explanations sound a little strange, here singleton is set in the service provider, which in theory should be a marker for laravel octane to keep it persistent...
|
Describe the bug
An error occurs in the SubscriptionRegistry when sending a subscription event.
The event is dispatched from model events.
Definition of subscription
Expected behavior/Solution
Steps to reproduce
Sometimes it works, sometimes it doesn't... I was unable to accurately reproduce the problem in 100% of cases.
Output/Logs
Click to expand
Lighthouse Version
6.34.1
The text was updated successfully, but these errors were encountered: