From b839493fea531e1d7d67e4b4a09c1d169024a4a7 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 26 May 2017 11:00:31 -0400 Subject: [PATCH] PERF: Limit new messages in suggested for PMs unlimited the query will hunt for ancient old PMs which is very expensive --- lib/topic_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index a392b94bf4e..62e6ec619b9 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -731,7 +731,7 @@ class TopicQuery def new_messages(params) - TopicQuery.new_filter(messages_for_groups_or_user(params[:my_group_ids]), 10.years.ago) + TopicQuery.new_filter(messages_for_groups_or_user(params[:my_group_ids]), Time.at(SiteSetting.min_new_topics_time).to_datetime) .limit(params[:count]) end