This is an automated email from the ASF dual-hosted git repository.

devmadhuu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new b041cee6759 HDDS-15453. [Recon] Refresh all capacity APIs on auto 
refresh (#10420)
b041cee6759 is described below

commit b041cee675945f7e4f47d79f32206890f5a77a04
Author: Priyesh Karatha <[email protected]>
AuthorDate: Tue Jun 9 19:50:56 2026 +0530

    HDDS-15453. [Recon] Refresh all capacity APIs on auto refresh (#10420)
---
 .../src/v2/pages/capacity/capacity.tsx             | 50 ++++++++++------------
 1 file changed, 23 insertions(+), 27 deletions(-)

diff --git 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx
 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx
index b2e8e0522a0..68b614c1b1d 100644
--- 
a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx
+++ 
b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx
@@ -38,9 +38,9 @@ import { useApiData } from '@/v2/hooks/useAPIData.hook';
 import * as CONSTANTS from '@/v2/constants/capacity.constants';
 import { UtilizationResponse, SCMPendingDeletion, OMPendingDeletion, 
DNPendingDeletion, DataNodeUsage } from '@/v2/types/capacity.types';
 import { useAutoReload } from '@/v2/hooks/useAutoReload.hook';
+import { AUTO_RELOAD_INTERVAL_DEFAULT } from 
'@/constants/autoReload.constants';
 
 type CapacityState = {
-  isDNPending: boolean;
   lastUpdated: number;
 };
 
@@ -51,7 +51,6 @@ const Capacity: React.FC<object> = () => {
   const DOWNLOAD_POLL_TIMEOUT_MS = 10 * 60 * 1000;
 
   const [state, setState] = React.useState<CapacityState>({
-    isDNPending: true,
     lastUpdated: 0
   });
 
@@ -87,7 +86,6 @@ const Capacity: React.FC<object> = () => {
     CONSTANTS.DEFAULT_DN_PENDING_DELETION,
     {
       retryAttempts: 2,
-      initialFetch: false,
       onError: (error) => showDataFetchError(error)
     }
   );
@@ -108,20 +106,23 @@ const Capacity: React.FC<object> = () => {
     omPendingDeletes.refetch();
     dnPendingDeletes.refetch();
     setState({
-      isDNPending: dnPendingDeletes.data.status !== "FINISHED",
       lastUpdated: Number(moment())
     })
   }
 
-  const loadDNData = () => {
-    dnPendingDeletes.refetch();
-    setState({
-      isDNPending: dnPendingDeletes.data.status !== "FINISHED",
-      lastUpdated: Number(moment())
-    })
-  } 
+  const loadDataIfIdle = () => {
+    if (
+      storageDistribution.loading ||
+      scmPendingDeletes.loading ||
+      omPendingDeletes.loading ||
+      dnPendingDeletes.loading
+    ) {
+      return;
+    }
+    loadData();
+  };
 
-  const autoReload = useAutoReload(loadDNData, PENDING_POLL_INTERVAL);
+  const autoReload = useAutoReload(loadDataIfIdle);
 
   const selectedDNDetails: DataNodeUsage & { pendingBlockSize: number } = 
React.useMemo(() => {
     const selected = storageDistribution.data.dataNodeUsage.find(datanode => 
datanode.hostName === selectedDatanode)
@@ -192,24 +193,19 @@ const Capacity: React.FC<object> = () => {
     }
   };
 
-  // Poll every 5s until status is FINISHED, then stop
+  // Adjust the polling interval based on DN scan status:
+  // fast (5s) while a scan is running, normal (60s) once finished.
+  // Honors the auto-reload toggle: if polling is OFF, do nothing.
   React.useEffect(() => {
-    if (dnPendingDeletes.data.status !== "FINISHED") {
-      if (!autoReload.isPolling) {
-        autoReload.startPolling(PENDING_POLL_INTERVAL);
-      }
+    if (!autoReload.isPolling) {
       return;
     }
-
-    if (autoReload.isPolling) {
-      autoReload.stopPolling();
-    }
-  }, [
-    dnPendingDeletes.data.status,
-    autoReload.isPolling,
-    autoReload.startPolling,
-    autoReload.stopPolling
-  ]);
+    autoReload.startPolling(
+      dnPendingDeletes.data.status === "FINISHED"
+        ? AUTO_RELOAD_INTERVAL_DEFAULT
+        : PENDING_POLL_INTERVAL
+    );
+  }, [dnPendingDeletes.data.status, autoReload.isPolling]); // 
eslint-disable-line react-hooks/exhaustive-deps
 
   const dnReportStatus = (
     (dnPendingDeletes.data.totalNodeQueriesFailed ?? 0) > 0


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to