snapshot cache

main
Tomáš Mládek 2024-04-05 21:03:54 +02:00
parent e9b50164a2
commit 99d855c4d4
1 changed files with 1 additions and 2 deletions

View File

@ -136,11 +136,10 @@ async function setupSnapshotServer(
if (magic) {
const hash = createHash("md5").update(magic).digest("hex");
const index = parseInt(hash.substring(0, 8), 16) % files.length;
// Cache until the next hour rolls over
res.sendFile(files[index], {
headers: {
"Cache-Control": `public, max-age=${
3600 - new Date().getMinutes() * 60
3600 - new Date().getMinutes() * 60 - new Date().getSeconds()
}`,
},
root: currentDir,