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

feat: expire changelog cache after 1 hour

parent f8a9ebf9
No related branches found
Tags 38.25.2
No related merge requests found
......@@ -22,19 +22,18 @@ async function getChangeLogJSON(args) {
const cacheVal = await cacache.get(...cache);
logger.trace(`Returning cached version of ${depName}`);
const cachedResult = JSON.parse(cacheVal.data.toString());
if (cachedResult) {
if (DateTime.local() < DateTime.fromISO(cachedResult.expiry)) {
logger.debug('Cache hit');
delete cachedResult.expiry;
return cachedResult;
}
logger.debug('Cache expiry');
if (
cachedResult &&
DateTime.local() < DateTime.fromISO(cachedResult.expiry)
) {
logger.debug('Cache hit');
delete cachedResult.expiry;
return cachedResult;
}
return null;
} catch (err) {
logger.debug('Cache miss');
return null;
}
return null;
}
async function setChangeLogJSON(args, res) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment