diff --git a/lib/middleware/template.js b/lib/middleware/template.js index c18ec8ceff..0653f2aecf 100644 --- a/lib/middleware/template.js +++ b/lib/middleware/template.js @@ -51,10 +51,12 @@ module.exports = async (ctx, next) => { }); } + const routeTtl = (config.cache.routeExpire / 60) | 0; + const data = { lastBuildDate: new Date().toUTCString(), updated: new Date().toISOString(), - ttl: config.cache.routeExpire, + ttl: routeTtl, ...ctx.state.data, }; if (template) { diff --git a/test/router.js b/test/router.js index 1ab4013c1f..23a13e9171 100644 --- a/test/router.js +++ b/test/router.js @@ -21,7 +21,7 @@ async function checkRSS(response) { expect(parsed.description).toEqual(expect.any(String)); expect(parsed.link).toEqual(expect.any(String)); expect(parsed.lastBuildDate).toEqual(expect.any(String)); - expect(parsed.ttl).toEqual(config.cache.routeExpire + ''); + expect(parsed.ttl).toEqual(((config.cache.routeExpire / 60) | 0) + ''); expect(parsed.items).toEqual(expect.any(Array)); checkDate(parsed.lastBuildDate);