diff --git a/lib/workers/pr/changelog/source-github.ts b/lib/workers/pr/changelog/source-github.ts index c3838e4b1c6e0ebe80187df0467d08c464eaf059..54f6198db4f347d260d35eee8338fbafd721f878 100644 --- a/lib/workers/pr/changelog/source-github.ts +++ b/lib/workers/pr/changelog/source-github.ts @@ -3,6 +3,7 @@ import { PLATFORM_TYPE_GITHUB } from '../../../constants/platforms'; import { Release } from '../../../datasource'; import { logger } from '../../../logger'; import * as globalCache from '../../../util/cache/global'; +import * as runCache from '../../../util/cache/run'; import * as hostRules from '../../../util/host-rules'; import { GithubHttp } from '../../../util/http/github'; import * as allVersioning from '../../../versioning'; @@ -12,7 +13,7 @@ import { addReleaseNotes } from './release-notes'; const http = new GithubHttp(); -async function getTags( +async function getTagsInner( endpoint: string, repository: string ): Promise<string[]> { @@ -41,6 +42,21 @@ async function getTags( } } +async function getTags( + endpoint: string, + repository: string +): Promise<string[]> { + const cacheKey = `getTags-${endpoint}-${repository}`; + const cachedResult = runCache.get(cacheKey); + // istanbul ignore if + if (cachedResult !== undefined) { + return cachedResult; + } + const promisedRes = getTagsInner(endpoint, repository); + runCache.set(cacheKey, promisedRes); + return promisedRes; +} + export async function getChangeLogJSON({ versioning, fromVersion,