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 · 3 comments

Comments

@patbenatar
Copy link
Contributor

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

@mnovelo mnovelo added the stale label Oct 29, 2024
@mnovelo mnovelo closed this as completed Oct 29, 2024
@patbenatar
Copy link
Contributor Author

@mnovelo is this fixed on main?

@mnovelo
Copy link
Collaborator

mnovelo commented Nov 3, 2024

@patbenatar this is not, nor do we have tests to verify whether it's needed. I'll look into it

@mnovelo mnovelo reopened this Nov 3, 2024
@github-actions github-actions bot removed the stale label Nov 4, 2024
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

3 participants