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 · 7 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
Copy link

github-actions bot commented Dec 4, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Dec 4, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2024
@mnovelo
Copy link
Collaborator

mnovelo commented Dec 11, 2024

Now that I'm done with school I have more time to look into this

@mnovelo mnovelo reopened this Dec 11, 2024
@patbenatar
Copy link
Contributor Author

@mnovelo that'd be awesome!

@mnovelo
Copy link
Collaborator

mnovelo commented Jan 9, 2025

This wasn't addressed in v3.2.0, but I hope to add such support in v4.0.0. Your help would be greatly appreciated! #312

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