A platform for community discussion. Free, open, simple.
FIX: Prevent slow bookmark first post reminder at query for topic (#11024)
Martin Brennan57d06518d419
diff --git a/lib/topic_view.rb b/lib/topic_view.rbindex c10c99a72fd..49c9e45b49e 100644--- a/lib/topic_view.rb+++ b/lib/topic_view.rb@@ -349,8 +349,12 @@ class TopicViewenddef first_post_bookmark_reminder_at- @topic.posts.with_deleted.where(post_number: 1).first- .bookmarks.where(user: @user).pluck_first(:reminder_at)+ @first_post_bookmark_reminder_at ||= \+ begin+ first_post = @topic.posts.with_deleted.find_by(post_number: 1)+ return if !first_post+ first_post.bookmarks.where(user: @user).pluck_first(:reminder_at)+ endendMAX_PARTICIPANTS = 24