Graphql Subscription query type #45
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is currently just a PoC.
The main challenge was to find a way to check for the changes in an efficient way.
Using 2 requests per query depths, we limit the performance impact.
NOTE:
The time complexity is
O(n)
wheren
is the depth of the query, not the number of elements.The number of elements does theoretically have an impact, but it's neglectable compared to the IO impact on time.
A code refactoring should be done as many features were added "on the spot".
Issues and limitations
Non specific change
A new result is sent whenever an object is changed even though it didn't impact the result (e.g. we changed field
A
but we don't use it in the query).This part can be done by computing and checking hashes based only on the requested fields.
Computed fields
We cannot detect changes on computed, non stored, fields as they don't change the
write_date
field. This limitation applies to all Odoo, there is nothing we can do except manually monitor it which could be disastrous in terms of performance.Worker Pool Starvation => Server Crash (?)
All implementation will systematically keep the worker open which could lead to "worker pool starvation": all workers are used, therefore Odoo cannot receive any other request.
I still need to confirm exactly the behavior but it's hard to imagine a stable solution for it.
I also need to experiment if this is still an issue with the latest version of Odoo, it's possible that now workers are able to take an unlimited number of requests.