snapshot cache
This commit is contained in:
parent
e9b50164a2
commit
99d855c4d4
1 changed files with 1 additions and 2 deletions
3
index.ts
3
index.ts
|
@ -136,11 +136,10 @@ async function setupSnapshotServer(
|
||||||
if (magic) {
|
if (magic) {
|
||||||
const hash = createHash("md5").update(magic).digest("hex");
|
const hash = createHash("md5").update(magic).digest("hex");
|
||||||
const index = parseInt(hash.substring(0, 8), 16) % files.length;
|
const index = parseInt(hash.substring(0, 8), 16) % files.length;
|
||||||
// Cache until the next hour rolls over
|
|
||||||
res.sendFile(files[index], {
|
res.sendFile(files[index], {
|
||||||
headers: {
|
headers: {
|
||||||
"Cache-Control": `public, max-age=${
|
"Cache-Control": `public, max-age=${
|
||||||
3600 - new Date().getMinutes() * 60
|
3600 - new Date().getMinutes() * 60 - new Date().getSeconds()
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
root: currentDir,
|
root: currentDir,
|
||||||
|
|
Loading…
Reference in a new issue