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 #26] Support configuration for skip checking of schema existence before switching #45

Merged
merged 5 commits into from
May 5, 2020

Conversation

rpbaltazar
Copy link
Contributor

@rpbaltazar rpbaltazar commented May 5, 2020

This is configurable by setting: tenant_presence_check. It defaults to true
in order to maintain the original gem behavior. This is only checked when using one of the PostgreSQL adapters.
The original gem behavior, when running switch would look for the existence of the schema before switching. This adds an extra query on every context switch. While in the default simple scenarios this is a valid check, in high volume platforms this adds some unnecessary overhead which can be detected in some other ways on the application level.

Setting this configuration value to false will disable the schema presence check before trying to switch the context.

Apartment.configure do |config|
  tenant_presence_check = false
end

@rpbaltazar rpbaltazar merged commit 49acd70 into development May 5, 2020
@rpbaltazar rpbaltazar deleted the support-configuration-for-skip-checking--26 branch May 5, 2020 09:48
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