PERF: Memoize TopicView#gaps results.

This commit is contained in:
Guo Xiang Tan 2018-06-21 12:37:24 +08:00
parent 6ddd214476
commit 5cef4e281b

View File

@ -103,7 +103,7 @@ class TopicView
def gaps
return unless @contains_gaps
Gaps.new(filtered_post_ids, unfiltered_posts.order(:sort_order).pluck(:id))
@gaps ||= Gaps.new(filtered_post_ids, unfiltered_posts.order(:sort_order).pluck(:id))
end
def last_post