Skip to content

Commit

Permalink
refactor(github): Use single cache namespace for release attachments (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Aug 27, 2024
1 parent 51ca695 commit ddcef9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/modules/datasource/github-release-attachments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class GithubReleaseAttachmentsDatasource extends Datasource {
ttlMinutes: 1440,
namespace: `datasource-${GithubReleaseAttachmentsDatasource.id}`,
key: (release: GithubRestRelease, digest: string) =>
`${release.html_url}:${digest}`,
`findDigestFile:${release.html_url}:${digest}`,
})
async findDigestFile(
release: GithubRestRelease,
Expand Down Expand Up @@ -83,9 +83,9 @@ export class GithubReleaseAttachmentsDatasource extends Datasource {

@cache({
ttlMinutes: 1440,
namespace: 'datasource-github-releases',
namespace: `datasource-${GithubReleaseAttachmentsDatasource.id}`,
key: (asset: GithubRestAsset, algorithm: string) =>
`${asset.browser_download_url}:${algorithm}:assetDigest`,
`downloadAndDigest:${asset.browser_download_url}:${algorithm}`,
})
async downloadAndDigest(
asset: GithubRestAsset,
Expand Down
4 changes: 2 additions & 2 deletions lib/util/cache/package/key.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { getCombinedKey } from './key';
describe('util/cache/package/key', () => {
describe('getCombinedKey', () => {
it('works', () => {
expect(getCombinedKey('datasource-github-releases', 'foo:bar')).toBe(
'global%%datasource-github-releases%%foo:bar',
expect(getCombinedKey('_test-namespace', 'foo:bar')).toBe(
'global%%_test-namespace%%foo:bar',
);
});
});
Expand Down
1 change: 0 additions & 1 deletion lib/util/cache/package/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export type PackageCacheNamespace =
| 'datasource-git'
| 'datasource-gitea-releases'
| 'datasource-gitea-tags'
| 'datasource-github-releases'
| 'datasource-github-release-attachments'
| 'datasource-gitlab-packages'
| 'datasource-gitlab-releases'
Expand Down

0 comments on commit ddcef9c

Please sign in to comment.