Skip to content

Add db rollback on gevent timeout error#389

Merged
MarcelGeo merged 3 commits intodevelopfrom
fix_rollback_error
Mar 3, 2025
Merged

Add db rollback on gevent timeout error#389
MarcelGeo merged 3 commits intodevelopfrom
fix_rollback_error

Conversation

@varmar05
Copy link
Collaborator

@varmar05 varmar05 commented Mar 3, 2025

Handle gevent exception when it occurs during db.session. Normally exception is propagated without any issues, however in case we need to do some cleanups (in finally clause) which involve db.session we need a special handling:

  • a rollback to unblock cleanup
  • reraise exception to be caught by middleware

@varmar05 varmar05 requested a review from MarcelGeo March 3, 2025 12:29
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13630944978

Details

  • 24 of 36 (66.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 92.28%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/mergin/sync/public_api_controller.py 1 7 14.29%
server/mergin/tests/test_middleware.py 23 29 79.31%
Totals Coverage Status
Change from base Build 13584997311: -0.1%
Covered Lines: 6801
Relevant Lines: 7370

💛 - Coveralls

Copy link
Collaborator

@MarcelGeo MarcelGeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one thing in tests.

We do not have any other places in code with handling of psycopg errors? If not , ok :)

@MarcelGeo MarcelGeo merged commit ec3dc14 into develop Mar 3, 2025
4 checks passed
@MarcelGeo MarcelGeo deleted the fix_rollback_error branch March 3, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants