Comments (5)
To fix this issue just add SubscriptionRegistry::class
to octane config octane.warm
.
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".
from lighthouse.
I propose an addition to the docs in #2575, does this look right?
from lighthouse.
The error only appears when used together with laravel octane (swoole). There is no error when using php-fpm.
from lighthouse.
Add dump to constuctor of SubscriptionRegistry
dump('subscription registry new instance: ' . spl_object_hash($this));
Got 2 instances
subscription registry new instance: 00000000000054960000000000000000
subscription registry new instance: 00000000000007ea0000000000000000
First request i got
array:1 [ // $subscriptions dump
0 => "scheduleUpdated"
]
spl_object_hash of SubscriptionRegistry: 00000000000007ea0000000000000000
Second and future requests
array:0 [] // $subscriptions dump
00000000000054960000000000000000
In the second and etc requests, subscription registration is not called...
from lighthouse.
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
Only singletons that are resolved during the application bootstrapping will persist between requests. Singletons that are resolved during request handling will be registered in the sandbox container, this container is destroyed after handling the request.
To persist singletons between requests, you can either resolve them in your service providers or add them to the warm array inside the Octane configuration file
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...
from lighthouse.
Related Issues (20)
- Segmentation fault when handling large payloads HOT 8
- Requesting local scopes can pass parameters HOT 1
- New directive that mirrors functionality of `whereHas` for relations (not `@whereHasConditions`) HOT 1
- `make setup` failed on macOS
- Access context in `FieldMiddleware` HOT 3
- CanArgs is defined twice in schema-directives.graphql
- `extend scalar X` directives are lost
- @canFind is missing "model" argument in graphql definition HOT 1
- Allow to customize the unique key for `PaginatedModelsLoader`
- artisan lighthouse:union stub appears to be incorrect HOT 1
- Problem with subscription middleware HOT 2
- Laravel v11 support dependancy missing
- Enum Support for Morph Types HOT 1
- Mutation transaction seem not work HOT 4
- Failed to find class App\GraphQl\Queries\TodoQuery in namespaces [] for directive @paginate
- @whereNull and @whereNotNull No directive found!
- GraphQL subscription with Laravel Reverb HOT 3
- input.id in @can(find: ) HOT 1
- Throttle directive sets wrong decay time HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lighthouse.