Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RUBY-3620 - Add Session.escape functionality #2917

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

Open
johnnyshields wants to merge 1 commit into mongodb:master
base: master
Choose a base branch
Loading
from tablecheck:session-escapable

Conversation

@johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Feb 10, 2025
edited
Loading

As per RUBY-3620, when using a Session transaction, there is no easy way to "escape" out of that transaction on the thread** and execute a one-off query. This is useful when you have queries that you want to execute regardless of whether the transaction succeeds or fails.

This PR adds Mongo::Session.escape { } to force executing queries outside the transaction.

(**you can spawn a new thread as a hacky workaround, but this comes with a host of it's own problems, such as needing to transfer in thread-specific state such as I18n.locale or Time.zone)

@johnnyshields johnnyshields changed the title (削除) Add session escape functionality (削除ここまで) (追記) RUBY-3620 - Add session escape functionality (追記ここまで) Feb 11, 2025
@johnnyshields johnnyshields changed the title (削除) RUBY-3620 - Add session escape functionality (削除ここまで) (追記) RUBY-3620 - Add Session.escape functionality (追記ここまで) Feb 11, 2025
Copy link
Contributor Author

johnnyshields commented Feb 11, 2025
edited
Loading

@jamis @comandeo-mongo I've raised 3 semi-related PRs:

As our app has grown in complexity, it is important to have greater ability to control query execution per session. Can you please review these changes and let me know if the approach is acceptable, or if you envision a different way of addressing the use cases?

Importantly, #2917 and #2918 may appear similar on the surface, but they actually address two different use cases. Our app would benefit from having them both.

Once you have reviewed, I or someone on my team will write the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /