Skip to content

Commit

Permalink
Remove logs and increase cache time
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Sep 16, 2024
1 parent 91f0ccd commit 77afb9e
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions app/api/library-hours/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ type FetchedData = {
}

export const dynamic = "force-static"
export const revalidate = 30
// export const revalidate = 28800
export const revalidate = 28800

const getLibraryHours = async (): Promise<Record<string, LocationHours>> => {
const from = new Date()
Expand All @@ -30,12 +29,6 @@ const getLibraryHours = async (): Promise<Record<string, LocationHours>> => {
params.set("from", from.toISOString().replace(/T.*/, ""))
params.set("to", to.toISOString().replace(/T.*/, ""))

if (new Date().getMinutes() >= 45) {
console.log("fail")
return {}
}

console.log("fetch")
const data: FetchedData = await fetch(`https://library-hours.stanford.edu/libraries.json?${params.toString()}`, {
cache: "no-store",
})
Expand Down

0 comments on commit 77afb9e

Please sign in to comment.