Add caching for payload serialization during fan-out (#19642)
This commit is contained in:
parent
b8f6f03956
commit
5f9e47be34
5 changed files with 129 additions and 7 deletions
|
@ -11,6 +11,7 @@ class InlineRenderer
|
|||
case @template
|
||||
when :status
|
||||
serializer = REST::StatusSerializer
|
||||
preload_associations_for_status
|
||||
when :notification
|
||||
serializer = REST::NotificationSerializer
|
||||
when :conversation
|
||||
|
@ -35,6 +36,16 @@ class InlineRenderer
|
|||
|
||||
private
|
||||
|
||||
def preload_associations_for_status
|
||||
ActiveRecord::Associations::Preloader.new.preload(@object, {
|
||||
active_mentions: :account,
|
||||
|
||||
reblog: {
|
||||
active_mentions: :account,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
def current_user
|
||||
@current_account&.user
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue