-
Notifications
You must be signed in to change notification settings - Fork 533
RUBY-3683 Fix CSOT for with_transaction #2941
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes CSOT (Client-Side Operation Timeout) handling in the with_transaction method by properly supporting zero/infinite timeouts and refactoring deadline calculation logic.
Key Changes:
- Refactored deadline calculation into a separate
calculate_with_transaction_deadlinemethod that handlestimeout_ms: 0as infinite timeout - Added
deadline_expired?helper method to properly check deadline expiration, treating0as never expired - Added comprehensive test coverage for CSOT scenarios including zero timeout, positive timeout, and disabled CSOT
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| spec/mongo/session_transaction_spec.rb | Adds test coverage for CSOT with with_transaction, including tests for zero timeout (infinite), positive timeout values, and disabled CSOT scenarios |
| lib/mongo/session.rb | Refactors with_transaction to extract deadline calculation logic and properly handle infinite timeouts (when timeout_ms: 0), plus adds helper method for deadline expiration checks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.