Skip to content

Commit

Permalink
refactor(github): Remove unused etag support for PR cache (#17665)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Sep 7, 2022
1 parent 7047677 commit a6139ad
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 32 deletions.
19 changes: 0 additions & 19 deletions lib/modules/platform/github/api-cache.spec.ts
Expand Up @@ -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();
});
});
});
12 changes: 0 additions & 12 deletions lib/modules/platform/github/api-cache.ts
Expand Up @@ -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
*/
Expand Down
1 change: 0 additions & 1 deletion lib/modules/platform/github/types.ts
Expand Up @@ -145,5 +145,4 @@ export interface ApiPageItem {
export interface ApiPageCache<T extends ApiPageItem = ApiPageItem> {
items: Record<number, T>;
lastModified?: string;
etag?: string;
}

0 comments on commit a6139ad

Please sign in to comment.