Skip to content
Snippets Groups Projects
Unverified Commit 36fcc0d5 authored by MeiMei's avatar MeiMei Committed by GitHub
Browse files

Cache extra AP objects (#6349)

* Cache extra AP objects

* Cache nodeinfo
parent 6667b866
No related branches found
Tags 13.11.0.beta-1
No related merge requests found
......@@ -37,6 +37,6 @@ export default async (ctx: Router.RouterContext) => {
);
ctx.body = renderActivity(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
};
......@@ -82,7 +82,7 @@ export default async (ctx: Router.RouterContext) => {
// index page
const rendered = renderOrderedCollection(partOf, user.followersCount, `${partOf}?page=true`);
ctx.body = renderActivity(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
}
};
......@@ -83,7 +83,7 @@ export default async (ctx: Router.RouterContext) => {
// index page
const rendered = renderOrderedCollection(partOf, user.followingCount, `${partOf}?page=true`);
ctx.body = renderActivity(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
}
};
......@@ -82,7 +82,6 @@ export default async (ctx: Router.RouterContext) => {
);
ctx.body = renderActivity(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
setResponseType(ctx);
} else {
// index page
......@@ -91,7 +90,7 @@ export default async (ctx: Router.RouterContext) => {
`${partOf}?page=true&since_id=000000000000000000000000`
);
ctx.body = renderActivity(rendered);
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
ctx.set('Cache-Control', 'public, max-age=180');
setResponseType(ctx);
}
};
......
......@@ -81,6 +81,7 @@ router.get(nodeinfo2_1path, async ctx => {
const base = await nodeinfo2();
ctx.body = { version: '2.1', ...base };
ctx.set('Cache-Control', 'public, max-age=600');
});
router.get(nodeinfo2_0path, async ctx => {
......@@ -89,6 +90,7 @@ router.get(nodeinfo2_0path, async ctx => {
delete base.software.repository;
ctx.body = { version: '2.0', ...base };
ctx.set('Cache-Control', 'public, max-age=600');
});
export default router;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment