mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Strict loading for SidebarSection queries (#21717)
What is this change required? I noticed that actions in `SidebarSectionsController` resulted in lots of N+1 queries problem and I wanted a solution to prevent such problems without having to write N+1 queries tests. I have also used strict loading for `SidebarSection` queries in performance sensitive spots. Note that in this commit, I have also set `config.active_record.action_on_strict_loading_violation = :log` for the production environment so that we have more visibility of potential N+1 queries problem in the logs. In development and test environment, we're sticking with the default of raising an error.
This commit is contained in:
committed by
GitHub
parent
916495e0a1
commit
5cfe323445
@@ -71,4 +71,6 @@ Discourse::Application.configure do
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
|
||||
end
|
||||
|
||||
config.active_record.action_on_strict_loading_violation = :log
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user