diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 1c3365ebcb1f60..1a1cf8ef1e416c 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -2354,7 +2354,7 @@ const options: RenovateOptions[] = [ 'Maximum duration in minutes to keep datasource cache entries.', type: 'integer', stage: 'repository', - default: 24 * 60, + default: 7 * 24 * 60, globalOnly: true, }, { diff --git a/lib/util/cache/package/decorator.spec.ts b/lib/util/cache/package/decorator.spec.ts index 5c79d564b78c17..e3d5de83da1912 100644 --- a/lib/util/cache/package/decorator.spec.ts +++ b/lib/util/cache/package/decorator.spec.ts @@ -161,7 +161,6 @@ describe('util/cache/package/decorator', () => { namespace: 'namespace', key: 'key', ttlMinutes: 1, - fallbackTtlMinutes: 2, }) // Hard TTL is enabled only for `getReleases` and `getDigest` methods @@ -172,6 +171,7 @@ describe('util/cache/package/decorator', () => { beforeEach(() => { jest.useFakeTimers({ advanceTimers: false }); + GlobalConfig.set({ cacheHardTtlMinutes: 2 }); }); afterEach(() => { diff --git a/lib/util/cache/package/decorator.ts b/lib/util/cache/package/decorator.ts index 249cf934fe0874..3508780a890b57 100644 --- a/lib/util/cache/package/decorator.ts +++ b/lib/util/cache/package/decorator.ts @@ -35,12 +35,6 @@ interface CacheParameters { * The TTL (or expiry) of the key in minutes */ ttlMinutes?: number; - - /** - * Store cached results for this many minutes after the TTL has expired, - * in case if the errors were thrown during obtaining the new results. - */ - fallbackTtlMinutes?: number; } /** @@ -51,7 +45,6 @@ export function cache({ key, cacheable = () => true, ttlMinutes = 30, - fallbackTtlMinutes = 0, }: CacheParameters): Decorator { return decorate(async ({ args, instance, callback, methodName }) => { if (!cacheable.apply(instance, args)) { @@ -86,10 +79,13 @@ export function cache({ const ttlOverride = getTtlOverride(finalNamespace); const softTtl = ttlOverride ?? ttlMinutes; - const globalFallbackTtlMinutes = GlobalConfig.get('cacheHardTtlMinutes', 0); + const cacheHardTtlMinutes = GlobalConfig.get( + 'cacheHardTtlMinutes', + 7 * 24 * 60 + ); let hardTtl = softTtl; if (methodName === 'getReleases' || methodName === 'getDigest') { - hardTtl = Math.max(softTtl, fallbackTtlMinutes, globalFallbackTtlMinutes); + hardTtl = Math.max(softTtl, cacheHardTtlMinutes); } let oldData: unknown;