Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax Polling Rate of Status Page #2866

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/scorekeeper-status-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const App = () => {
const [jobs, setJobs] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const [hasError, setHasError] = useState(false);
const [refreshInterval, setRefreshInterval] = useState(500); // Default refresh interval
const [refreshInterval, setRefreshInterval] = useState(5000); // Default refresh interval
wpank marked this conversation as resolved.
Show resolved Hide resolved
const [nominators, setNominators] = useState([]);

const fetchData = useCallback(async () => {
Expand All @@ -66,7 +66,7 @@ const App = () => {
})),
);
setHasError(false);
setRefreshInterval(800); // Reset to faster refresh rate on success
setRefreshInterval(5000); // Reset to faster refresh rate on success
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoded value here ?

Comment says "faster", but 5000 is the same value of the REFRESH_INTERVAL constant, which seems to be used for the "Slow down" scenario...

=> maybe we need REFRESH_INTERVAL_FAST and REFRESH_INTERVAL_SLOW ?

} else {
// Handle empty response
console.log("Received empty response");
Expand Down Expand Up @@ -122,12 +122,12 @@ const App = () => {
}, [currentEndpoint]);

useEffect(() => {
const interval = setInterval(fetchData, 500);
const interval = setInterval(fetchData, 5000);
return () => clearInterval(interval);
}, [fetchData]);

useEffect(() => {
const interval = setInterval(fetchNominatorsData, 500);
const interval = setInterval(fetchNominatorsData, 5000);
return () => clearInterval(interval);
}, [fetchNominatorsData]);

Expand Down
2 changes: 1 addition & 1 deletion packages/scorekeeper-status-ui/src/EraStatsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const EraStatsBar = ({ currentEndpoint }) => {
}
};

const interval = setInterval(fetchEraStats, 500);
const interval = setInterval(fetchEraStats, 5000);
return () => clearInterval(interval);
}, [currentEndpoint]);

Expand Down
2 changes: 1 addition & 1 deletion packages/scorekeeper-status-ui/src/HealthCheckBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const HealthCheckBar = ({ currentEndpoint }) => {
}
};

const interval = setInterval(fetchHealthData, 500);
const interval = setInterval(fetchHealthData, 5000);
return () => clearInterval(interval);
}, [currentEndpoint]);

Expand Down