Skip to content

Commit

Permalink
Merge pull request #261 from carverauto/updates/fixing_refresh_rate
Browse files Browse the repository at this point in the history
cleanup and fixing refresh rate
  • Loading branch information
mfreeman451 authored Feb 27, 2025
2 parents 0fea6af + e333e86 commit b2e68c6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions serviceradar-next/src/app/nodes/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ async function fetchNodes() {
export default async function NodesPage() {
const initialNodes = await fetchNodes();

console.log("NodesPage rendered with initialNodes length:", initialNodes.length);

return (
<div>
<Suspense fallback={<div className="flex justify-center items-center h-64">
Expand Down
2 changes: 1 addition & 1 deletion serviceradar-next/src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useAPIData } from '@/lib/api';

function Dashboard({ initialData = null }) {
// Use improved API client with caching - refresh every 30 seconds instead of 10
const { data: systemStatus, error, isLoading } = useAPIData('/api/status', initialData, 30000);
const { data: systemStatus, error, isLoading } = useAPIData('/api/status', initialData, 10000);

if (isLoading && !systemStatus) {
return (
Expand Down
3 changes: 1 addition & 2 deletions serviceradar-next/src/components/NodeList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ function NodeList({ initialNodes = [] }) {
const [sortBy, setSortBy] = useState('name');
const [sortOrder, setSortOrder] = useState('asc');

// Use the improved API client with 30 second polling instead of 10
const { data: nodes, error, isLoading } = useAPIData('/api/nodes', initialNodes, 30000);
const { data: nodes, error, isLoading } = useAPIData('/api/nodes', initialNodes, 10000);

const sortNodesByName = useCallback((a, b) => {
const aMatch = a.node_id.match(/(\d+)$/);
Expand Down
4 changes: 1 addition & 3 deletions serviceradar-next/src/components/ServiceSparkline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import _ from 'lodash';
import { useAPIData } from '../lib/api';

const MAX_POINTS = 100;
const POLLING_INTERVAL = 30000; // 30 seconds
const POLLING_INTERVAL = 10000; // 10 seconds

const ServiceSparkline = React.memo(({ nodeId, serviceName, initialMetrics = [] }) => {
const { data: metrics, error, isLoading } = useAPIData(
Expand Down Expand Up @@ -59,8 +59,6 @@ const ServiceSparkline = React.memo(({ nodeId, serviceName, initialMetrics = []
setError(error); // Sync error state with useAPIData
}, [error]);

console.log("ServiceSparkline rendered", { nodeId, serviceName, metricsLength: metrics?.length, isLoading, error: errorState });

if (isLoading && !processedMetrics.length) {
return <div className="flex flex-col items-center transition-colors h-8 w-24">
<div className="h-8 w-24 bg-gray-100 dark:bg-gray-700 animate-pulse rounded"></div>
Expand Down

0 comments on commit b2e68c6

Please sign in to comment.