Tighten YouTube RSS cache to 15 min (matches YouTube CDN max-age)

This commit is contained in:
Z User 2026-11-05 20:34:38 +00:00
parent c6aabdcbce
commit f67bf32643

2
src/routes/youtube.js Normal file → Executable file
View File

@ -7,7 +7,7 @@ const router = express.Router();
const CHANNEL_ID = 'UCG_ZDOP21i0Ah26FxiuZmkg'; const CHANNEL_ID = 'UCG_ZDOP21i0Ah26FxiuZmkg';
const RSS_URL = `https://www.youtube.com/feeds/videos.xml?channel_id=${CHANNEL_ID}`; const RSS_URL = `https://www.youtube.com/feeds/videos.xml?channel_id=${CHANNEL_ID}`;
const MAX_VIDEOS = 3; const MAX_VIDEOS = 3;
const CACHE_TTL_MS = 30 * 60 * 1000; // refresh from YouTube every 30 minutes const CACHE_TTL_MS = 15 * 60 * 1000; // refresh from YouTube every 15 min (matches YouTube RSS own max-age=900)
// In-memory cache (also serves stale data if YouTube is unreachable) // In-memory cache (also serves stale data if YouTube is unreachable)
let cache = { videos: null, fetchedAt: 0 }; let cache = { videos: null, fetchedAt: 0 };