Skip to content

Commit a13760e

Browse files
author
Ed Safford
committed
Change cycleTime poll period.
1 parent 11f2528 commit a13760e

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

UIdev/ObsMon/src/App.jsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import MainContent from "./MainContent.jsx";
55
import { withBase } from './utils/paths.js';
66

77
import RadianceCategory from './components/RadianceCategory.jsx';
8-
// import { geostationarySatellites } from "./data/geosats";
9-
// import { infraredSatellites } from './data/infrasats.js';
10-
// import { microwaveSatellites } from './data/microwavesats.js';
118
import OzoneObs from './components/OzoneObs.jsx'
129
import ConventionalObs from './components/ConventionalObs.jsx';
1310

@@ -119,9 +116,19 @@ function App() {
119116

120117
fetchCycle(); // Load on mount
121118

122-
const interval = setInterval(fetchCycle, 60000); // Poll every 60 seconds
119+
const interval = setInterval(fetchCycle, 300000); // Poll every 5 min
120+
// Optionally fetch when tab becomes visible again
121+
const handleVisibilityChange = () => {
122+
if (document.visibilityState === 'visible') {
123+
fetchCycle();
124+
}
125+
};
126+
document.addEventListener('visibilitychange', handleVisibilityChange);
123127

124-
return () => clearInterval(interval); // Cleanup
128+
return () => {
129+
clearInterval(interval);
130+
document.removeEventListener('visibilitychange', handleVisibilityChange);
131+
};
125132
}, []);
126133

127134
return (

0 commit comments

Comments
 (0)