From 0dc20a48192a8e276202a65414ebdcb2da39bc9e Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Mon, 26 Aug 2024 15:34:19 -0300 Subject: [PATCH 1/3] refactor(deno): Use single cache namespace --- lib/modules/datasource/deno/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/datasource/deno/index.ts b/lib/modules/datasource/deno/index.ts index e396c3b7d8a8b4..6043f1c2ca7f0d 100644 --- a/lib/modules/datasource/deno/index.ts +++ b/lib/modules/datasource/deno/index.ts @@ -37,7 +37,7 @@ export class DenoDatasource extends Datasource { namespace: `datasource-${DenoDatasource.id}`, key: ({ packageName, registryUrl }: GetReleasesConfig) => // TODO: types (#22198) - `${registryUrl}:${packageName}`, + `getReleases:${registryUrl}:${packageName}`, }) async getReleases({ packageName, @@ -70,8 +70,8 @@ export class DenoDatasource extends Datasource { } @cache({ - namespace: `datasource-${DenoDatasource.id}-versions`, - key: (moduleAPIURL) => moduleAPIURL, + namespace: `datasource-${DenoDatasource.id}`, + key: (moduleAPIURL) => `getReleaseResult:${moduleAPIURL}`, }) async getReleaseResult(moduleAPIURL: string): Promise { const releasesCache: Record = From 31748a2786cf79114f34e26c0e9e3fd94fe568e3 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Mon, 26 Aug 2024 15:44:46 -0300 Subject: [PATCH 2/3] Fix --- lib/util/cache/package/types.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/util/cache/package/types.ts b/lib/util/cache/package/types.ts index ae3e9ddc240584..36153fa9eecfef 100644 --- a/lib/util/cache/package/types.ts +++ b/lib/util/cache/package/types.ts @@ -42,8 +42,6 @@ export type PackageCacheNamespace = | 'datasource-cpan' | 'datasource-crate-metadata' | 'datasource-crate' - | 'datasource-deno-details' - | 'datasource-deno-versions' | 'datasource-deno' | 'datasource-docker-architecture' | 'datasource-docker-hub-cache' From 528bc4ed24066513b6d6c3637004cf28136905e1 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Mon, 26 Aug 2024 15:52:52 -0300 Subject: [PATCH 3/3] Fix --- lib/modules/datasource/deno/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/modules/datasource/deno/index.ts b/lib/modules/datasource/deno/index.ts index 6043f1c2ca7f0d..e9ca1cca0527e2 100644 --- a/lib/modules/datasource/deno/index.ts +++ b/lib/modules/datasource/deno/index.ts @@ -74,10 +74,11 @@ export class DenoDatasource extends Datasource { key: (moduleAPIURL) => `getReleaseResult:${moduleAPIURL}`, }) async getReleaseResult(moduleAPIURL: string): Promise { + const detailsCacheKey = `details:${moduleAPIURL}`; const releasesCache: Record = (await packageCache.get( - `datasource-${DenoDatasource.id}-details`, - moduleAPIURL, + `datasource-${DenoDatasource.id}`, + detailsCacheKey, )) ?? {}; let cacheModified = false; @@ -119,8 +120,8 @@ export class DenoDatasource extends Datasource { if (cacheModified) { // 1 week. Releases at Deno are immutable, therefore we can use a long term cache here. await packageCache.set( - `datasource-${DenoDatasource.id}-details`, - moduleAPIURL, + `datasource-${DenoDatasource.id}`, + detailsCacheKey, releasesCache, 10080, );