diff --git a/server.js b/server.js index 5c5f4ca..71c6340 100644 --- a/server.js +++ b/server.js @@ -2205,7 +2205,7 @@ const SHARE_HOSTS = String(process.env.SHARE_HOSTS || 'ctbgo.com,mylinehq.com'). // by exchange and safelist image fields, so the banners never show). /b// serves the same file from // game-banners// on the Spaces CDN, bytes in place (no redirect: some sites only HEAD the URL), on the share hosts as // well as here: https://ctbgo.com/b/turkeydrop/728x90.png. A bare . expands to -.. Small -// in-memory cache, 300 files, six hours, misses remembered ten minutes. +// in-memory cache, 300 files, six hours, misses remembered one minute (a banner uploaded after someone asked for it shows up fast). const BANNER_CDN = 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/'; const BANNER_TYPES = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', webp: 'image/webp', gif: 'image/gif' }; const bannerCache = new Map(); // cdn url -> { buf, type, at, miss } @@ -2216,7 +2216,7 @@ async function serveBanner(req, res, p) { let name = m[2].toLowerCase(); if (/^\d{2,4}x\d{2,4}$/.test(name)) name = slug + '-' + name; const url = BANNER_CDN + slug + '/' + name + '.' + ext; let hit = bannerCache.get(url); - if (!hit || Date.now() - hit.at > (hit.miss ? 600e3 : 6 * 3600e3)) { + if (!hit || Date.now() - hit.at > (hit.miss ? 60e3 : 6 * 3600e3)) { try { const r = await fetch(url, { signal: AbortSignal.timeout(10000) }); if (r.ok) {