Skip to content
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

[Resolves #27] Added before hook to connected to to try to set the tenant #40

Merged
merged 2 commits into from
Apr 15, 2020

Conversation

rpbaltazar
Copy link
Contributor

@rpbaltazar rpbaltazar commented Apr 15, 2020

  • Monkeypatch connected_to rails active record method to try to ensure that whenever we switch connection we connect to the proper tenant

  • Removed allow_prepend_tenant_name configuration because we ran into concurrency issues. When the connection goes back to the pool its attributes are set with the old values and we were getting queries being made to the wrong tenant. I still think that using this prepend_tenant seems like a good idea but I'll need further testing and investigation on how to make it safe. There is a bug reported in the original apartment gem that seems to report similar issues (Any code that uses threads and the AR connection pool could mix data influitive/apartment#186)

@rpbaltazar rpbaltazar merged commit b19ba24 into development Apr 15, 2020
@rpbaltazar rpbaltazar deleted the add-hook-to-before-connect branch April 15, 2020 04:24
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.

1 participant