spacemonkd commented on code in PR #10615:
URL: https://github.com/apache/ozone/pull/10615#discussion_r3534951372


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/capacity/capacity.tsx:
##########
@@ -194,17 +203,23 @@ const Capacity: React.FC<object> = () => {
   };
 
   // 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.
+  // fast (5s) while a scan is running (regardless of auto-reload toggle, since
+  // the scan is async and must be tracked to completion), normal (60s) once
+  // finished — but only if the user has auto-reload enabled.
   React.useEffect(() => {
-    if (!autoReload.isPolling) {
-      return;
+    if (dnPendingDeletes.data.status !== "FINISHED") {
+      autoReload.startPolling(PENDING_POLL_INTERVAL);
+    } else if (autoReload.isPolling) {
+      // Scan just finished while fast-polling was active.
+      // Switch to normal interval only if the user still wants auto-reload;
+      // otherwise stop so we don't override the toggle.
+      const autoReloadEnabled = sessionStorage.getItem('autoReloadEnabled') 
!== 'false';
+      if (autoReloadEnabled) {
+        autoReload.startPolling(AUTO_RELOAD_INTERVAL_DEFAULT);

Review Comment:
   One nit, `startPolling` causes `setIsPolling(true)`, which changes 
`autoReload.isPolling`, which is a dependency of this effect.
   ```
   [dnPendingDeletes.data.status, autoReload.isPolling]
   ```
   
   Currently the debounce of 100ms inside `startPolling` (`stopPolling()` then 
`poll()`) prevents infinite API calls, but it still causes unnecessary effect 
re-executions. Maybe we could revert this back and tackle it in another JIRA if 
there is an issue?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to