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