Skip to content

Commit

Permalink
Add daily refresh to nuxt site
Browse files Browse the repository at this point in the history
  • Loading branch information
ncpleslie committed Oct 13, 2024
1 parent 5aa1fa4 commit f6a12e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ export default defineNuxtConfig({
baseWmataUrl: "https://api.wmata.com",
useMockTrainService: false,
public: {
refreshInMs: 60000,
incidentRefreshInMs: 120000,
refreshInMs: 60000, // 1min
incidentRefreshInMs: 120000, // 2mins
applicationRefreshInMs: 86400000, // 24hrs
},
},
app: {
Expand Down
2 changes: 2 additions & 0 deletions nuxt/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const { data: station, refresh: refreshStation } = useGetStationById(
useMountedInterval(refreshTrains, runtimeConfig.public.refreshInMs);
useMountedInterval(refreshIncidents, runtimeConfig.public.incidentRefreshInMs);
// Reload the whole app every 24hrs to prevent expanding memory usage.
useMountedInterval(reloadNuxtApp, runtimeConfig.public.applicationRefreshInMs);
const hasIncidents = computed(
() =>
Expand Down

0 comments on commit f6a12e1

Please sign in to comment.