Skip to content

Commit 12cd897

Browse files
committed
fix(apps): set the cache duration for versions.json file to four days
Use a 4 day cache for the version.json file to prevent it from causing queuing/slowness in the action as a whole.
1 parent f4a6bc2 commit 12cd897

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apps/functions/dns-redirecting/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ export const dnsRedirecting = functions.https.onRequest(
4747
const versionsData = await fetch('https://material.angular.dev/assets/versions.json').then(
4848
(r) => r.json(),
4949
);
50-
response.set('Content-Type', 'application/json').send(JSON.stringify(versionsData));
50+
// 4 Days in seconds
51+
const cacheDuration = 60 * 60 * 24 * 4;
52+
response
53+
.set('Cache-Control', `public, max-age=${cacheDuration}, s-maxage=${cacheDuration}`)
54+
.set('Content-Type', 'application/json')
55+
.send(JSON.stringify(versionsData));
5156
return;
5257
}
5358
response.redirect(redirectType, `https://material.angular.dev${request.originalUrl}`);

0 commit comments

Comments
 (0)