-
Notifications
You must be signed in to change notification settings - Fork 239
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
Use with_connection instead of calling release_connection directly #340
base: master
Are you sure you want to change the base?
Conversation
…ince the latter may release a connection that belongs to someone else
I recently rediscovered this PR. What can I do to help get this merged? |
This commit fixes an issue where a database proxy tries to access the type_caster on the aliased arel table. Since this is just an alias table of the current model, it makes sense to use the current model's type_caster for the alias.
Fix hierarchy cleanup error when using type_caster
Can you please rebase on |
Unfortunately I no longer have access to instructure-bridge as I don't work for Instructure any more. Maybe @williamshupe can? I'm not sure if this will ping him, but unfortunately I don't have a better way of contacting him. |
I no longer have access to the repository either, sorry. |
Reviving #320 under a different organization and on the latest version of master.
The call to release_connection, added in #263, might release a connection that was opened outside of has_closure_tree (if the caller is loaded dynamically in the middle of some other operation). This is especially problematic if the connection has an ongoing transaction, as that transaction will be lost.
This PR changes has_closure_tree to use with_connection instead, which only releases a connection if it was acquired. If a connection already existed prior to the call to has_closure_tree, it won't be released.
@seuros made a comment on the previous version of this PR about Databaseless setup, which I didn't understand. If someone could point me at a doc/readme/whatever I'll gladly add the necessary tests.