mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
PERF: cache category topic ids
This commit is contained in:
parent
c1a01b2a28
commit
1c964bf730
3 changed files with 17 additions and 2 deletions
|
@ -699,7 +699,7 @@ class TopicQuery
|
|||
|
||||
def random_suggested(topic, count, excluded_topic_ids=[])
|
||||
result = default_results(unordered: true, per_page: count).where(closed: false, archived: false)
|
||||
excluded_topic_ids += Category.pluck(:topic_id).compact
|
||||
excluded_topic_ids += Category.topic_ids.to_a
|
||||
result = result.where("topics.id NOT IN (?)", excluded_topic_ids) unless excluded_topic_ids.empty?
|
||||
|
||||
result = remove_muted_categories(result, @user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue