diff --git a/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx b/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx index 86c632a67..2df0402f3 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/Installation.tsx @@ -112,11 +112,11 @@ function SodioHomeInstallation(props: singleInstallationProps) { } const fetchDataPeriodically = async () => { - var timeperiodToSearch = 200; + var timeperiodToSearch = 350; let res; let timestampToFetch; - for (var i = 0; i < timeperiodToSearch; i += 2) { + for (var i = 0; i < timeperiodToSearch; i += 30) { if (!continueFetching.current) { return false; } @@ -184,13 +184,13 @@ function SodioHomeInstallation(props: singleInstallationProps) { }; const fetchDataForOneTime = async () => { - var timeperiodToSearch = 300; // 5 minutes to cover ~4 upload cycles + var timeperiodToSearch = 300; // 5 minutes to cover ~2 upload cycles (150s each) let res; let timestampToFetch; // Search from NOW backward to find the most recent data - // Step by 10 seconds - balances between finding files quickly and reducing 404s - for (var i = 0; i < timeperiodToSearch; i += 10) { + // Step by 50 seconds - data is uploaded every ~150s, so finer steps are wasteful + for (var i = 0; i < timeperiodToSearch; i += 50) { timestampToFetch = UnixTime.now().earlier(TimeSpan.fromSeconds(i)); try { res = await fetchDataJson(timestampToFetch, s3Credentials, false); @@ -264,7 +264,7 @@ function SodioHomeInstallation(props: singleInstallationProps) { const configRefreshInterval = setInterval(() => { console.log('Refreshing configuration data from S3...'); fetchDataForOneTime(); - }, 15000); // Refresh every 15 seconds + }, 60000); // Refresh every 60 seconds (data uploads every ~150s) return () => { continueFetching.current = false; diff --git a/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/SodistoreHomeConfiguration.tsx b/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/SodistoreHomeConfiguration.tsx index cad3fcbbc..e6fbe1582 100644 --- a/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/SodistoreHomeConfiguration.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/SodiohomeInstallations/SodistoreHomeConfiguration.tsx @@ -143,9 +143,9 @@ function SodistoreHomeConfiguration(props: SodistoreHomeConfigurationProps) { const submittedAt = pendingConfig.submittedAt || 0; const timeSinceSubmit = Date.now() - submittedAt; - // Within 150 seconds of submit: use localStorage (waiting for S3 sync) - // This covers two full S3 upload cycles (75 sec × 2) to ensure new file is available - if (timeSinceSubmit < 150000) { + // Within 300 seconds of submit: use localStorage (waiting for S3 sync) + // This covers two full S3 upload cycles (150 sec × 2) to ensure new file is available + if (timeSinceSubmit < 300000) { // Check if S3 now matches - if so, sync is complete const s3MatchesPending = s3Values.controlPermission === pendingConfig.values.controlPermission && @@ -247,7 +247,7 @@ function SodistoreHomeConfiguration(props: SodistoreHomeConfigurationProps) { setLoading(false); // Save submitted values to localStorage for optimistic UI update - // This ensures the form shows correct values even before S3 syncs (up to 75 sec delay) + // This ensures the form shows correct values even before S3 syncs (up to 150 sec delay) localStorage.setItem(pendingConfigKey, JSON.stringify({ values: formValues, submittedAt: Date.now()