Skip to content
Snippets Groups Projects
Commit ce69d851 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

feat(changelog): cache getTags requests per run

parent 083a10c3
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment