PERF: Rely on preload for first_post for TopicBookmarkable (#18066)
In 49a70a37f1
I removed the
topic: :posts preload for TopicBookmarkable, but did not
update the UserTopicBookmarkSerializer to reflect this,
which was causing up to multi-hundred millisecond queries to
be made for each topic bookmark based on the size of the
topic.
This commit is contained in:
parent
7a58bd8827
commit
4b84236bc1
|
@ -11,7 +11,7 @@ class UserTopicBookmarkSerializer < UserPostTopicBookmarkBaseSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def first_post
|
def first_post
|
||||||
@first_post ||= topic.posts.find { |post| post.post_number == 1 }
|
@first_post ||= topic.first_post
|
||||||
end
|
end
|
||||||
|
|
||||||
def deleted
|
def deleted
|
||||||
|
|
Loading…
Reference in New Issue