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

fix: revert pagination cache

parent f239df80
No related branches found
No related tags found
No related merge requests found
...@@ -42,23 +42,6 @@ async function get(path, options, retries = 5) { ...@@ -42,23 +42,6 @@ async function get(path, options, retries = 5) {
const pageLimit = opts.pageLimit || 10; const pageLimit = opts.pageLimit || 10;
const linkHeader = parseLinkHeader(res.headers.link); const linkHeader = parseLinkHeader(res.headers.link);
if (linkHeader && linkHeader.next && linkHeader.last) { if (linkHeader && linkHeader.next && linkHeader.last) {
const { etag } = res.headers;
const cacheNamespace = 'github-pagination';
// istanbul ignore next
try {
const cacheResult = await renovateCache.get(cacheNamespace, path);
if (cacheResult.etag === etag) {
logger.debug({ path }, 'Returning cached paginated result');
res.body = cacheResult.body;
return res;
}
logger.debug(
{ oldEtag: cacheResult.etag, newEtag: etag, path },
'Outdated pagination cache'
);
} catch (err) {
logger.trace({ path }, 'Paginated cache miss');
}
let lastPage = +linkHeader.last.page; let lastPage = +linkHeader.last.page;
if (!process.env.RENOVATE_PAGINATE_ALL) { if (!process.env.RENOVATE_PAGINATE_ALL) {
lastPage = Math.min(pageLimit, lastPage); lastPage = Math.min(pageLimit, lastPage);
...@@ -78,17 +61,6 @@ async function get(path, options, retries = 5) { ...@@ -78,17 +61,6 @@ async function get(path, options, retries = 5) {
res.body = res.body.concat( res.body = res.body.concat(
...pages.filter(Boolean).map(page => page.body) ...pages.filter(Boolean).map(page => page.body)
); );
try {
const cacheMinutes = 60 * 24;
await renovateCache.set(
cacheNamespace,
path,
{ etag, body: res.body },
cacheMinutes
);
} catch (err) /* istanbul ignore next */ {
logger.warn('Error setting renovateCache value');
}
} }
} }
if ( if (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment