about summary refs log tree commit diff
path: root/app/controllers/api/v1/timelines/public_controller.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-09-15 22:44:56 -0500
committermultiple creatures <dev@multiple-creature.party>2019-09-15 22:44:56 -0500
commitc80712e1c88734b3604467ab4438f242b3a40ef9 (patch)
tree403922960ec2e9379811339769ba3194c8c5915f /app/controllers/api/v1/timelines/public_controller.rb
parent6695379f081d730afa907f687adf11f3c8d6f041 (diff)
stop pre-caching media on public, home, direct, & list timelines
Diffstat (limited to 'app/controllers/api/v1/timelines/public_controller.rb')
-rw-r--r--app/controllers/api/v1/timelines/public_controller.rb13
1 files changed, 1 insertions, 12 deletions
diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb
index e5f38508c..9c3f6c0a8 100644
--- a/app/controllers/api/v1/timelines/public_controller.rb
+++ b/app/controllers/api/v1/timelines/public_controller.rb
@@ -22,12 +22,7 @@ class Api::V1::Timelines::PublicController < Api::BaseController
   end
 
   def public_statuses
-    ptl = public_timeline_statuses
-    preload_media(ptl.paginate_by_id(
-      DEFAULT_STATUSES_LIMIT * 2,
-      params_slice(:max_id, :since_id, :min_id)
-    ))
-    statuses = ptl.paginate_by_id(
+    statuses = public_timeline_statuses.paginate_by_id(
       limit_param(DEFAULT_STATUSES_LIMIT),
       params_slice(:max_id, :since_id, :min_id)
     )
@@ -68,10 +63,4 @@ class Api::V1::Timelines::PublicController < Api::BaseController
   def pagination_since_id
     @statuses.first.id
   end
-
-  def preload_media(statuses)
-    status_ids = statuses.joins(:media_attachments).distinct(:id).select(:id).reorder(nil)
-    fetch_ids = MediaAttachment.where(status_id: status_ids, file_updated_at: nil).reject { |m| m.blocked? }.pluck(:id)
-    fetch_ids.each { |m| FetchMediaWorker.perform_async(m) }
-  end
 end