feat: improve card loading speed (#2124)

* feat: improve card loading times

This commit adds the `stale-while-revalidate` option to speed up the
card loading times.

* mend
This commit is contained in:
Rick Staa authored and GitHub committed 2022-11-21 10:21:46 +01:00
1 parent f07cd133d3
commit 3cb205c65b
5 files changed
+54 -9

No files matched your search

+6 -1
View File
@@ -58,7 +58,12 @@ export default async (req, res) => {
cacheSeconds = CONSTANTS.FOUR_HOURS;
}
res.setHeader("Cache-Control", `public, max-age=${cacheSeconds}`);
res.setHeader(
"Cache-Control",
`max-age=${
cacheSeconds / 2
}, s-maxage=${cacheSeconds}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
);
return res.send(
renderRepoCard(repoData, {