Don't wait for stars update
All checks were successful
Deploy / build-and-publish (push) Successful in 1m7s
Deploy / deploy (push) Successful in 12s

This commit is contained in:
2024-09-30 02:38:46 +03:00
parent 2a3e59921b
commit 17bef7f18c
3 changed files with 115 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ const CACHE_LIFE = 1000 * 60 * 5
let lastRequest = Date.now()
let starCount: number | null = null
export const load: PageServerLoad = async () => {
async function updateStars() {
const now = Date.now()
if (now - CACHE_LIFE > lastRequest || starCount === null) {
@@ -17,6 +17,10 @@ export const load: PageServerLoad = async () => {
console.log(error)
}
}
}
export const load: PageServerLoad = () => {
updateStars()
return {
starCount,