From 7f5ba917563aa1c9a373d9dd3a6a29f73d81ee9a Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Thu, 19 Nov 2020 16:28:21 -0600 Subject: Cache requests to status objects by requesting account --- app/controllers/statuses_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb index a3ba43d7b..ad065a6fa 100644 --- a/app/controllers/statuses_controller.rb +++ b/app/controllers/statuses_controller.rb @@ -39,7 +39,12 @@ class StatusesController < ApplicationController format.json do expires_in 3.minutes, public: @status.distributable? && public_fetch_mode? - render_with_cache json: @status, content_type: 'application/activity+json', serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter, domain: current_account&.domain + render_with_cache json: @status, + content_type: 'application/activity+json', + serializer: ActivityPub::NoteSerializer, + adapter: ActivityPub::Adapter, + domain: current_account&.domain, + key: "statuses/json:#{current_account&.id}:#{@status.id}" end end end @@ -50,7 +55,8 @@ class StatusesController < ApplicationController content_type: 'application/activity+json', serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter, - domain: current_account&.domain + domain: current_account&.domain, + key: "statuses/activity:#{current_account&.id}:#{@status.id}" end def embed -- cgit