From e333e86340811896c109d9217d172bd5a765921c Mon Sep 17 00:00:00 2001 From: Michael Freeman Date: Wed, 26 Feb 2025 21:58:33 -0600 Subject: [PATCH] cleanup and fixing refresh rate --- serviceradar-next/src/app/nodes/page.js | 2 -- serviceradar-next/src/components/Dashboard.jsx | 2 +- serviceradar-next/src/components/NodeList.jsx | 3 +-- serviceradar-next/src/components/ServiceSparkline.jsx | 4 +--- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/serviceradar-next/src/app/nodes/page.js b/serviceradar-next/src/app/nodes/page.js index 4262149..64e270a 100644 --- a/serviceradar-next/src/app/nodes/page.js +++ b/serviceradar-next/src/app/nodes/page.js @@ -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 (
diff --git a/serviceradar-next/src/components/Dashboard.jsx b/serviceradar-next/src/components/Dashboard.jsx index 8d324a7..22090e5 100644 --- a/serviceradar-next/src/components/Dashboard.jsx +++ b/serviceradar-next/src/components/Dashboard.jsx @@ -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 ( diff --git a/serviceradar-next/src/components/NodeList.jsx b/serviceradar-next/src/components/NodeList.jsx index 901d250..d5cf4e8 100644 --- a/serviceradar-next/src/components/NodeList.jsx +++ b/serviceradar-next/src/components/NodeList.jsx @@ -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+)$/); diff --git a/serviceradar-next/src/components/ServiceSparkline.jsx b/serviceradar-next/src/components/ServiceSparkline.jsx index 8dd1b06..33e226a 100644 --- a/serviceradar-next/src/components/ServiceSparkline.jsx +++ b/serviceradar-next/src/components/ServiceSparkline.jsx @@ -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( @@ -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