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

Rails 7 load_async queries public schema when invoking queries on the async thread pool #199

Open
patbenatar opened this issue Mar 25, 2022 · 1 comment

Comments

@patbenatar
Copy link

Steps to reproduce

Create a Rails 7 app with load_async enabled (config.active_record.async_query_executor = :global_thread_pool). Switch into a tenant schema. Use load_async to load an AR relation.

Expected behavior

Whether the query is invoked async or sync, the records returned should be from the tenant schema.

Actual behavior

The records returned when the query is invoked async are from the public schema.

System configuration

  • Database: Postgres 13

  • Apartment version: 7d7c73c

  • Apartment config (in config/initializers/apartment.rb or so):

    • use_schemas: default, so true
  • Rails (or ActiveRecord) version: 7.0.2.3

  • Ruby version: 3.1.1

@lifelenz
Copy link

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

No branches or pull requests

2 participants