change stale time to three minutes (#7158)

This commit is contained in:
Hailey
2024-12-18 10:58:26 -08:00
committed by GitHub
parent 3481d16577
commit 5c4f870898
2 changed files with 12 additions and 7 deletions
+11 -6
View File
@@ -1,15 +1,20 @@
const SECOND = 1e3
const MINUTE = SECOND * 60
const HOUR = MINUTE * 60
export const STALE = { export const STALE = {
SECONDS: { SECONDS: {
FIFTEEN: 1e3 * 15, FIFTEEN: 15 * SECOND,
THIRTY: 1e3 * 30, THIRTY: 30 * SECOND,
}, },
MINUTES: { MINUTES: {
ONE: 1e3 * 60, ONE: MINUTE,
FIVE: 1e3 * 60 * 5, THREE: 3 * MINUTE,
THIRTY: 1e3 * 60 * 30, FIVE: 5 * MINUTE,
THIRTY: 30 * MINUTE,
}, },
HOURS: { HOURS: {
ONE: 1e3 * 60 * 60, ONE: HOUR,
}, },
INFINITY: Infinity, INFINITY: Infinity,
} }
@@ -22,7 +22,7 @@ export function useTrendingTopics() {
return useQuery({ return useQuery({
refetchOnWindowFocus: true, refetchOnWindowFocus: true,
staleTime: STALE.MINUTES.THIRTY, staleTime: STALE.MINUTES.THREE,
queryKey: trendingTopicsQueryKey, queryKey: trendingTopicsQueryKey,
async queryFn() { async queryFn() {
const {data} = await agent.api.app.bsky.unspecced.getTrendingTopics({ const {data} = await agent.api.app.bsky.unspecced.getTrendingTopics({