From a6139ad5fea5f1005c92756fb75df5380c6343f3 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov <zharinov@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:29:45 +0300 Subject: [PATCH] refactor(github): Remove unused `etag` support for PR cache (#17665) --- lib/modules/platform/github/api-cache.spec.ts | 19 ------------------- lib/modules/platform/github/api-cache.ts | 12 ------------ lib/modules/platform/github/types.ts | 1 - 3 files changed, 32 deletions(-) diff --git a/lib/modules/platform/github/api-cache.spec.ts b/lib/modules/platform/github/api-cache.spec.ts index 2c831ed17f..007145f1c6 100644 --- a/lib/modules/platform/github/api-cache.spec.ts +++ b/lib/modules/platform/github/api-cache.spec.ts @@ -205,23 +205,4 @@ describe('modules/platform/github/api-cache', () => { expect(needNextPage).toBeFalse(); }); }); - - describe('etag', () => { - it('returns null', () => { - const apiCache = new ApiCache({ items: {} }); - expect(apiCache.etag).toBeNull(); - }); - - it('sets and retrieves non-null value', () => { - const apiCache = new ApiCache({ items: {} }); - apiCache.etag = 'foobar'; - expect(apiCache.etag).toBe('foobar'); - }); - - it('deletes value for null parameter', () => { - const apiCache = new ApiCache({ items: {} }); - apiCache.etag = null; - expect(apiCache.etag).toBeNull(); - }); - }); }); diff --git a/lib/modules/platform/github/api-cache.ts b/lib/modules/platform/github/api-cache.ts index 016ddd7a75..12fe1ca900 100644 --- a/lib/modules/platform/github/api-cache.ts +++ b/lib/modules/platform/github/api-cache.ts @@ -5,18 +5,6 @@ import type { ApiPageCache, ApiPageItem } from './types'; export class ApiCache<T extends ApiPageItem> { constructor(private cache: ApiPageCache<T>) {} - get etag(): string | null { - return this.cache.etag ?? null; - } - - set etag(value: string | null) { - if (value === null) { - delete this.cache.etag; - } else { - this.cache.etag = value; - } - } - /** * @returns Date formatted to use in HTTP headers */ diff --git a/lib/modules/platform/github/types.ts b/lib/modules/platform/github/types.ts index e790de784f..86fdc330c6 100644 --- a/lib/modules/platform/github/types.ts +++ b/lib/modules/platform/github/types.ts @@ -145,5 +145,4 @@ export interface ApiPageItem { export interface ApiPageCache<T extends ApiPageItem = ApiPageItem> { items: Record<number, T>; lastModified?: string; - etag?: string; } -- GitLab