mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 21:24:45 +08:00
PERF: Update TopicView#participant_count
to use Topic#posts_count
.
Use the counter cache instead of hitting the DB and plucking every single id.
This commit is contained in:
@ -310,7 +310,7 @@ class TopicView
|
|||||||
@participant_count ||=
|
@participant_count ||=
|
||||||
begin
|
begin
|
||||||
if participants.size == MAX_PARTICIPANTS
|
if participants.size == MAX_PARTICIPANTS
|
||||||
if unfiltered_post_ids.length > MAX_POSTS_COUNT_PARTICIPANTS
|
if @topic.posts_count > MAX_POSTS_COUNT_PARTICIPANTS
|
||||||
@topic.participant_count
|
@topic.participant_count
|
||||||
else
|
else
|
||||||
sql = <<~SQL
|
sql = <<~SQL
|
||||||
|
Reference in New Issue
Block a user