diff --git a/Build/lib/cache-filesystem.ts b/Build/lib/cache-filesystem.ts index 397b29d1..1a812891 100644 --- a/Build/lib/cache-filesystem.ts +++ b/Build/lib/cache-filesystem.ts @@ -33,6 +33,27 @@ interface CacheApplyStringOption { type CacheApplyOption = T extends string ? CacheApplyStringOption : CacheApplyNonStringOption; +const randomInt = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min; +// Add some randomness to the cache ttl to avoid thundering herd +export const TTL = { + humanReadable(ttl: number) { + if (ttl >= 24 * 60 * 60 * 1000) { + return `${Math.round(ttl / 24 / 60 / 60 / 1000)}d`; + } + if (ttl >= 60 * 60 * 1000) { + return `${Math.round(ttl / 60 / 60 / 1000)}h`; + } + return `${Math.round(ttl / 1000)}s`; + }, + THREE_HOURS: () => randomInt(1, 3) * 60 * 60 * 1000, + TWLVE_HOURS: () => randomInt(8, 12) * 60 * 60 * 1000, + ONE_DAY: () => randomInt(23, 25) * 60 * 60 * 1000, + THREE_DAYS: () => randomInt(1, 3) * 24 * 60 * 60 * 1000, + ONE_WEEK: () => randomInt(5, 7) * 24 * 60 * 60 * 1000, + TWO_WEEKS: () => randomInt(10, 14) * 24 * 60 * 60 * 1000, + TEN_DAYS: () => randomInt(7, 10) * 24 * 60 * 60 * 1000 +}; + export class Cache { db: Database; tbd = 60 * 1000; // time before deletion @@ -108,7 +129,7 @@ export class Cache { const cached = this.get(key); let value: T; if (cached == null) { - console.log(picocolors.yellow('[cache] miss'), picocolors.gray(key), picocolors.gray(`ttl: ${ttl / 60 * 60 * 1000}h`)); + console.log(picocolors.yellow('[cache] miss'), picocolors.gray(key), picocolors.gray(`ttl: ${TTL.humanReadable(ttl)}`)); value = await fn(); const serializer = 'serializer' in opt ? opt.serializer : identity; @@ -132,19 +153,6 @@ export const fsCache = new Cache({ cachePath: path.resolve(import.meta.dir, '../ // fsCache.destroy(); // }); -const randomInt = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min; - -// Add some randomness to the cache ttl to avoid thundering herd -export const TTL = { - THREE_HOURS: () => randomInt(1, 3) * 60 * 60 * 1000, - TWLVE_HOURS: () => randomInt(8, 12) * 60 * 60 * 1000, - ONE_DAY: () => randomInt(23, 25) * 60 * 60 * 1000, - THREE_DAYS: () => randomInt(1, 3) * 24 * 60 * 60 * 1000, - ONE_WEEK: () => randomInt(5, 7) * 24 * 60 * 60 * 1000, - TWO_WEEKS: () => randomInt(10, 14) * 24 * 60 * 60 * 1000, - TEN_DAYS: () => randomInt(7, 10) * 24 * 60 * 60 * 1000 -}; - const separator = '\u0000'; // const textEncoder = new TextEncoder(); // const textDecoder = new TextDecoder(); diff --git a/Source/domainset/reject_sukka.conf b/Source/domainset/reject_sukka.conf index 49e3d41c..fe175b08 100644 --- a/Source/domainset/reject_sukka.conf +++ b/Source/domainset/reject_sukka.conf @@ -1873,3 +1873,17 @@ adserve2.tom.com .hola.sk .hola.org .holacdn.com + +# EasyPrivacy Migration +.click.signaturemarket.co +.link.clubmanagergame.com +.link.ag.fan +.wp-tw.americanexpress.com +.mail.dolce-gusto.cz +.smetrics.suncorpbank.com.au +.smetrics.viabcp.com +.metrics.reallymoving.com +.adbmetrics.koreanair.com +.link.plazahogar.com.py +.link.localmasters.co +.trk.drdobbs.com