From f6a12e1b5c71915e96f876b4ffb954f2f2ac7a26 Mon Sep 17 00:00:00 2001 From: Nick Leslie Date: Sun, 13 Oct 2024 18:34:44 -0400 Subject: [PATCH] Add daily refresh to nuxt site --- nuxt/nuxt.config.ts | 5 +++-- nuxt/pages/index.vue | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nuxt/nuxt.config.ts b/nuxt/nuxt.config.ts index d4c7b46..8146671 100644 --- a/nuxt/nuxt.config.ts +++ b/nuxt/nuxt.config.ts @@ -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: { diff --git a/nuxt/pages/index.vue b/nuxt/pages/index.vue index 3be7691..9560fc6 100644 --- a/nuxt/pages/index.vue +++ b/nuxt/pages/index.vue @@ -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( () =>