mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
fix: Downgrade log level for http cache cleanup (#28447)
This commit is contained in:
parent
41e6be8b94
commit
49005e0246
3 changed files with 7 additions and 9 deletions
2
lib/util/cache/repository/http-cache.spec.ts
vendored
2
lib/util/cache/repository/http-cache.spec.ts
vendored
|
@ -10,7 +10,7 @@ describe('util/cache/repository/http-cache', () => {
|
|||
});
|
||||
|
||||
it('should not throw if cache is not a valid HttpCache', () => {
|
||||
expect(() => cleanupHttpCache('not a valid cache')).not.toThrow();
|
||||
expect(() => cleanupHttpCache({})).not.toThrow();
|
||||
});
|
||||
|
||||
it('should remove expired items from the cache', () => {
|
||||
|
|
10
lib/util/cache/repository/http-cache.ts
vendored
10
lib/util/cache/repository/http-cache.ts
vendored
|
@ -1,15 +1,15 @@
|
|||
import is from '@sindresorhus/is';
|
||||
import { DateTime } from 'luxon';
|
||||
import { GlobalConfig } from '../../../config/global';
|
||||
import { logger } from '../../../logger';
|
||||
import { HttpCacheSchema } from '../../http/cache/schema';
|
||||
import type { RepoCacheData } from './types';
|
||||
|
||||
export function cleanupHttpCache(cacheData: unknown): void {
|
||||
if (!is.plainObject(cacheData) || !is.plainObject(cacheData['httpCache'])) {
|
||||
logger.warn('cleanupHttpCache: invalid cache data');
|
||||
export function cleanupHttpCache(cacheData: RepoCacheData): void {
|
||||
const { httpCache } = cacheData;
|
||||
if (!httpCache) {
|
||||
logger.trace('cleanupHttpCache: no http cache to clean up');
|
||||
return;
|
||||
}
|
||||
const httpCache = cacheData['httpCache'];
|
||||
|
||||
const ttlDays = GlobalConfig.get('httpCacheTtlDays', 90);
|
||||
if (ttlDays === 0) {
|
||||
|
|
2
lib/util/cache/repository/impl/base.ts
vendored
2
lib/util/cache/repository/impl/base.ts
vendored
|
@ -71,9 +71,7 @@ export abstract class RepoCacheBase implements RepoCache {
|
|||
}
|
||||
|
||||
async save(): Promise<void> {
|
||||
if (this.data) {
|
||||
cleanupHttpCache(this.data);
|
||||
}
|
||||
const jsonStr = safeStringify(this.data);
|
||||
const hashedJsonStr = hash(jsonStr);
|
||||
if (hashedJsonStr === this.oldHash) {
|
||||
|
|
Loading…
Reference in a new issue