cache
This commit is contained in:
parent
303c2132a1
commit
fb56769405
1 changed files with 5 additions and 6 deletions
|
@ -25,9 +25,9 @@ const entriesCacheTimeLimit = 1000 * 15;
|
|||
|
||||
async function getEntriesCached() {
|
||||
if (entriesCacheTime + entriesCacheTimeLimit < Date.now()) {
|
||||
const data = await ptApi.query();
|
||||
entriesCache = JSON.stringify(data);
|
||||
entriesCacheTime = Date.now();
|
||||
const data = await ptApi.query();
|
||||
entriesCache = JSON.stringify(data);
|
||||
entriesCacheTime = Date.now();
|
||||
}
|
||||
return entriesCache;
|
||||
}
|
||||
|
@ -100,9 +100,8 @@ Bun.serve({
|
|||
|
||||
globalThis.loginTokens.add(token);
|
||||
|
||||
if (entriesCacheTime + entriesCacheTimeLimit < Date.now()) {
|
||||
setTimeout(getEntriesCached, 1);
|
||||
}
|
||||
setTimeout(getEntriesCached, 1);
|
||||
|
||||
return new Response('Login successful', { headers });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue