use time constant in nodeinfo
Some checks failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
Norm 2022-10-31 19:00:09 -04:00
parent 52ad5049de
commit f950b08dbf
Signed by: norm
GPG key ID: 7123E30E441E80DE

View file

@ -4,6 +4,7 @@ import config from '@/config/index.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Users, Notes } from '@/models/index.js';
import { Cache } from '@/misc/cache.js';
import { MINUTE, SECOND } from '@/const.js';
const router = new Router();
@ -108,7 +109,7 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
};
};
const cache = new Cache<NodeInfo2Base>(1000 * 60 * 10);
const cache = new Cache<NodeInfo2Base>(10 * MINUTE);
router.get(nodeinfo2_1path, async ctx => {
const base = await cache.fetch(null, () => nodeinfo2());