Skip to content

Conversation

@jdelStrother
Copy link
Contributor

Description of changes

WDYT to something like this? It includes async: true in the payload of ActiveRecord logs if the query is async.

For synchronous queries, I've left the payload as-is (rather than adding async: false), on the assumption that 99% of your queries are probably synchronous, but I don't have a strong feeling either way on that.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@reidmorrison reidmorrison merged commit 9e2c0f9 into reidmorrison:master Jul 24, 2025
@reidmorrison
Copy link
Owner

@jdelStrother after merging into master, the Rails 8 tests are failing with

ActiveRecord::logs#test_0008_marks async queries with async: true:
ActiveRecord::ActiveRecordError: Can't perform asynchronous queries without a query session
    activerecord (8.0.2) lib/active_record/asynchronous_queries_tracker.rb:50:in 'ActiveRecord::AsynchronousQueriesTracker#current_session'
    activerecord (8.0.2) lib/active_record/core.rb:142:in 'ActiveRecord::Base.asynchronous_queries_session'

I made the test skip the test under rails 8 for now.

@jdelStrother
Copy link
Contributor Author

I'll take a look when I'm back next week

@jdelStrother jdelStrother mentioned this pull request Jul 31, 2025
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.

2 participants