Add caching for payload serialization during fan-out (#19642)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user