perf(rpki): increase refresh intervals to reduce memory pressure

RPKI feed refresh: 10min -> 4h (RPKI data is stable, RIRs publish once/day)
Atlas probe refresh: 1h -> 12h (probe list rarely changes)

Frequent 825k-ROA reloads caused memory spikes on server with no swap,
triggering OOM kills and PM2 restart loops.
This commit is contained in:
Rene Fichtmueller 2026-03-28 22:29:03 +08:00
parent f8578a2176
commit 4b2c6774fa

View File

@ -80,7 +80,7 @@ function cacheSet(key, data, ttlMs) {
}
const CACHE_TTL_LOOKUP = 5 * 60 * 1000; // 5 minutes
const CACHE_TTL_ASPA = 10 * 60 * 1000; // 10 minutes
const CACHE_TTL_ASPA = 4 * 60 * 60 * 1000; // 4 hours
const CACHE_TTL_NEWS = 10 * 60 * 1000; // 10 minutes
const CACHE_TTL_DEFAULT = 5 * 60 * 1000; // 5 minutes
@ -252,7 +252,7 @@ function fetchRpkiAspaFeed() {
// Ensure ASPA cache is fresh (fetch if older than 10 minutes)
async function ensureAspaCache() {
if (Date.now() - rpkiAspaLastFetch > 10 * 60 * 1000) {
if (Date.now() - rpkiAspaLastFetch > 4 * 60 * 60 * 1000) {
await fetchRpkiAspaFeed();
}
}
@ -3103,9 +3103,9 @@ Promise.all([fetchRpkiAspaFeed(), fetchAllAtlasProbes(), fetchPdbOrgCountries()]
// Refresh RPKI ASPA cache every 10 minutes
setInterval(() => {
fetchRpkiAspaFeed();
}, 10 * 60 * 1000);
}, 4 * 60 * 60 * 1000);
// Refresh Atlas probe cache every hour
// Refresh Atlas probe cache every 12 hours
setInterval(function() {
fetchAllAtlasProbes();
}, 60 * 60 * 1000);
}, 12 * 60 * 60 * 1000);