jayeshchoudhary commented on code in PR #15657:
URL: https://github.com/apache/pinot/pull/15657#discussion_r2065921535


##########
pinot-controller/src/main/resources/app/pages/TenantDetails.tsx:
##########
@@ -505,6 +550,68 @@ const TenantPageDetails = ({ match }: 
RouteComponentProps<Props>) => {
       dispatch({type: 'error', message: 'Failed to trigger 
RealtimeSegmentValidationManager with error: ' + error, show: true});
     }
   };
+  // Pause or resume consumption for realtime tables with polling status
+  const doPauseResume = async () => {
+    const willPause = !pauseStatusData?.pauseFlag;
+    setPauseActionType(willPause ? 'pause' : 'resume');
+    setIsPauseActionInProgress(true);
+    try {
+      const result: PauseStatusDetails = willPause
+        ? await PinotMethodUtils.pauseConsumptionOp(tableName, "Pause 
Triggered from Admin UI")
+        : await PinotMethodUtils.resumeConsumptionOp(tableName, "Resume 
Triggered from Admin UI", "lastConsumed");
+      dispatch({
+        type: 'success',
+        message: willPause
+          ? "Pause Flag set in Ideal state, waiting for consuming segments to 
commit"
+          : "Pause flag cleared, waiting for consumption to resume",
+        show: true
+      });
+      if (pausePollingRef.current) {
+        clearInterval(pausePollingRef.current);
+      }
+      pausePollingRef.current = window.setInterval(async () => {
+        try {
+          const status = await PinotMethodUtils.getPauseStatusData(tableName);
+          setPauseStatusData(status);
+          const settled = willPause
+            ? (status.pauseFlag && (!status.consumingSegments || 
status.consumingSegments.length === 0))
+            : !status.pauseFlag;
+          if (settled) {
+            if (pausePollingRef.current) {
+              clearInterval(pausePollingRef.current);
+            }
+            setIsPauseActionInProgress(false);
+            setPauseActionType(null);
+          }
+        } catch {
+          // ignore polling errors
+        }
+      }, 2000);

Review Comment:
   2s seems too less for pooling, should we consider 5 or 10s?



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to