-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
[17.0] Oca port from 16.0 to 17.0 pr 387 422 #459
Merged
OCA-git-bot
merged 6 commits into
OCA:17.0
from
acsone:oca-port-from-16.0-to-17.0-pr-387-422
Oct 3, 2024
Merged
[17.0] Oca port from 16.0 to 17.0 pr 387 422 #459
OCA-git-bot
merged 6 commits into
OCA:17.0
from
acsone:oca-port-from-16.0-to-17.0-pr-387-422
Oct 3, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Defines specific dependencies to support case where te authentication is optional.
This change fix an issue that prevented the system to retry a call to the application in case of a DB concurrency error if this error is defined as retryable. By default, any call to the application is retried in case of a DB concurrency if retryable. The 'retry' mechanism is implemented at the early stage of the processing of a request in case of specific postgreSQL errors. When a call is made to a fastapi application, the specific handler for the request is placed further down the stack. Before this change, any error that occurred in the specific fastapi handler was catch by the Fastapi processing stack and never bubbled up to the early stage of the processing where the 'retry' mechanism is implemented. This change fix this issue by putting in place a way to make some specific exceptions bubble up the fastapi processing stack through the event loop required to transform WSGI to ASGI.
This change is a complete rewrite of the way the transactions are managed when integrating a fastapi application into Odoo. In the previous implementation, specifics error handlers were put in place to catch exception occurring in the handling of requests made to a fastapi application and to rollback the transaction in case of error. This was done by registering specifics error handlers methods to the fastapi application using the 'add_exception_handler' method of the fastapi application. In this implementation, the transaction was rolled back in the error handler method. This approach was not working as expected for several reasons: - The handling of the error at the fastapi level prevented the retry mechanism to be triggered in case of a DB concurrency error. This is because the error was catch at the fastapi level and never bubbled up to the early stage of the processing of the request where the retry mechanism is implemented. - The cleanup of the environment and the registry was not properly done in case of error. In the **'odoo.service.model.retrying'** method, you can see that the cleanup process is different in case of error raised by the database and in case of error raised by the application. This change fix these issues by ensuring that errors are no more catch at the fastapi level and bubble up the fastapi processing stack through the event loop required to transform WSGI to ASGI. As result the transactional nature of the requests to the fastapi applications is now properly managed by the Odoo framework.
/ocabot merge major |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 3fa322b. Thanks a lot for contributing to OCA. ❤️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.