-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Ensure isolation_level
is set.
#219
Conversation
This change makes me a bit nervous. I attempted to enable
I think the issue is that Rails will check out a connection when needed, but keep the connection open for the duration of the request. So, if you're hanging on a long running HTTP request (as I am) before sending a response, you may have a lot of open connections at once. There appears to be a workaround in surrounding database calls with a The alternative (using In any case, I'm happy to discuss further, and apologies if I'm misunderstanding things here, but I wanted to call attention because I think this may be something that a user should make a conscious decision to enable vs being automatic? |
Thanks for raising your concern, and it's very reasonable. I believe you can still explicitly override the isolation level IIUC, so you can explicitly opt into per-thread connection handling/isolation in your config. Do you mind confirming this works? i.e. add an explicit config in If that turns out to be a valid use case (which it sounds like it is in your case), let's add further documentation to clarify it. I believe most users will want this behaviour (per-fiber by default), and the next step is to provide a per-query AR connection pool mode. Once we have that, we can probably ALSO add that here, e.g. There are several people working on the AR connection pool issues so I believe we will get to a proper solution by Rails 7.2 if we are lucky or 8.0 if the changes are more extensive. |
Thanks for the thoughtful reply. After giving it some more consideration, I agree I was able to confirm that you can override the default in As for considering a bit more documentation, I was thinking perhaps something like the following change/addition:
...becomes:
Let me know if you'd like me to draft a PR, or feel free to use that as a starting point, or ignore this if you think it's not worth documenting at this point. Thanks again! |
That looks super, please draft a PR :) |
To avoid potential mis-configuration when used with rails, we can use a railtie to set the
isolation_level
correctly.See #218 for more context.
I don't like how we are (optionally) coupling falcon to Rails, but I'm not sure there is a good alternative. I considered a separate gem, but people may miss it.
Types of Changes
Contribution