mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 12:56:47 +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:
parent
cfa7898c2d
commit
eb427f7cf4
|
@ -310,7 +310,7 @@ class TopicView
|
|||
@participant_count ||=
|
||||
begin
|
||||
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
|
||||
else
|
||||
sql = <<~SQL
|
||||
|
|
Loading…
Reference in New Issue
Block a user