From 92f20e9b1ad69b76edd7d8df1a8b01fcd653c33a Mon Sep 17 00:00:00 2001 From: Nimrod Kramer <41470823+nimrodkra@users.noreply.github.com> Date: Mon, 9 Mar 2026 15:30:50 +0200 Subject: [PATCH 1/2] fix(sitemaps): reduce sitemap cache max-age to two hours Lower sitemap cache-control TTL from 4h to 2h so removed or updated URLs are reflected faster, and update sitemap header assertions accordingly. Made-with: Cursor --- __tests__/sitemaps.ts | 4 ++-- src/routes/sitemaps.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/sitemaps.ts b/__tests__/sitemaps.ts index 853df44c35..a3fa02a908 100644 --- a/__tests__/sitemaps.ts +++ b/__tests__/sitemaps.ts @@ -286,7 +286,7 @@ describe('GET /sitemaps/agents-digest.xml', () => { expect(res.header['content-type']).toContain('application/xml'); expect(res.header['cache-control']).toEqual( - 'public, max-age=14400, s-maxage=14400', + 'public, max-age=7200, s-maxage=7200', ); expect(res.text).toContain( '', @@ -321,7 +321,7 @@ describe('GET /sitemaps/squads.xml', () => { expect(res.header['content-type']).toContain('application/xml'); expect(res.header['cache-control']).toEqual( - 'public, max-age=14400, s-maxage=14400', + 'public, max-age=7200, s-maxage=7200', ); expect(res.text).toContain( '', diff --git a/src/routes/sitemaps.ts b/src/routes/sitemaps.ts index dfec012ab5..836c69fb0b 100644 --- a/src/routes/sitemaps.ts +++ b/src/routes/sitemaps.ts @@ -19,7 +19,7 @@ import { SelectQueryBuilder, } from 'typeorm'; -const SITEMAP_CACHE_CONTROL = 'public, max-age=14400, s-maxage=14400'; +const SITEMAP_CACHE_CONTROL = 'public, max-age=7200, s-maxage=7200'; const SITEMAP_LIMIT = 50_000; const ARENA_SITEMAP_GROUP_IDS = [ '385404b4-f0f4-4e81-a338-bdca851eca31', From d2ba3fbdc7aea056da43499c1c510481b77dab2d Mon Sep 17 00:00:00 2001 From: Nimrod Kramer <41470823+nimrodkra@users.noreply.github.com> Date: Mon, 9 Mar 2026 15:42:18 +0200 Subject: [PATCH 2/2] refactor(sitemaps): replace cache TTL magic numbers with constants Use ONE_HOUR_IN_SECONDS to express the 2-hour sitemap cache TTL and align with repository guidance against hardcoded time duration values. Made-with: Cursor --- src/routes/sitemaps.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/sitemaps.ts b/src/routes/sitemaps.ts index 836c69fb0b..e2a92087c7 100644 --- a/src/routes/sitemaps.ts +++ b/src/routes/sitemaps.ts @@ -12,6 +12,7 @@ import { import { AGENTS_DIGEST_SOURCE } from '../entity/Source'; import createOrGetConnection from '../db'; import { Readable } from 'stream'; +import { ONE_HOUR_IN_SECONDS } from '../common/constants'; import { DataSource, EntityManager, @@ -19,7 +20,7 @@ import { SelectQueryBuilder, } from 'typeorm'; -const SITEMAP_CACHE_CONTROL = 'public, max-age=7200, s-maxage=7200'; +const SITEMAP_CACHE_CONTROL = `public, max-age=${2 * ONE_HOUR_IN_SECONDS}, s-maxage=${2 * ONE_HOUR_IN_SECONDS}`; const SITEMAP_LIMIT = 50_000; const ARENA_SITEMAP_GROUP_IDS = [ '385404b4-f0f4-4e81-a338-bdca851eca31',