server: increase nodeinfo caching

Changelog: Changed
This commit is contained in:
Johann150 2022-12-04 03:26:50 +01:00
parent 2dde8273e2
commit cda9197700
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -107,11 +107,17 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
};
};
/*
Nodeinfo is cacheable for 1 day, the parts that change are the usage statistics
and those should not be time critical.
*/
const cacheControl = 'public, max-age=86400';
router.get(nodeinfo2_1path, async ctx => {
const base = await nodeinfo2();
ctx.body = { version: '2.1', ...base };
ctx.set('Cache-Control', 'public, max-age=600');
ctx.set('Cache-Control', cacheControl);
});
router.get(nodeinfo2_0path, async ctx => {
@ -120,7 +126,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');
ctx.set('Cache-Control', cacheControl);
});
export default router;