mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
PERF: Cache serialized voters at topic view level (#28894)
This commit introduces a way to fetch the "serialized voters" for multiple polls. * Use a single query to fetch voters for all types of polls * Refactor to introduce all_serialized_voters * Cache serialized voters
This commit is contained in:
@ -45,13 +45,9 @@ RSpec.describe PostsController do
|
||||
|
||||
# Expected queries:
|
||||
#
|
||||
# - all queries listed for "when not logged in"
|
||||
# - all queries listed for "when not logged in" (except it loads voters for polls in post5, post6 and post7)
|
||||
# - query to find out if the user has voted in each poll
|
||||
# - queries to get "serialized voters" (NOT TRACKED)
|
||||
# - voters for poll in post5
|
||||
# - voters for poll in post6
|
||||
# - voters for poll in post7
|
||||
expect(poll_queries.size).to eq(8)
|
||||
expect(poll_queries.size).to eq(6)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user