bobpaulin commented on code in PR #11872:
URL: https://github.com/apache/nifi/pull/11872#discussion_r4556536472


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorRepository.java:
##########
@@ -733,6 +918,61 @@ private void waitForState(final ConnectorNode connector, 
final Set<ConnectorStat
         }
     }
 
+    private void waitForFlowEvolutionStatus(final ConnectorNode connector, 
final FlowEvolutionStatus desiredStatus)
+            throws FlowUpdateException, IOException, InterruptedException {
+        int pollIndex = 0;
+        while (true) {
+            if (connector.getFlowEvolutionStatus() == 
FlowEvolutionStatus.FAILED) {
+                throw new FlowUpdateException("Flow evolution was cancelled 
for " + connector);
+            }
+
+            if (requestReplicator != null) {
+                sleepForFlowEvolutionPoll(pollIndex++);
+            }
+            final FlowEvolutionStatus clusterStatus;
+            try {
+                clusterStatus = getFlowEvolutionStatus(connector);
+            } catch (final RuntimeException e) {
+                if (!isNoConnectedNodes(e)) {
+                    throw e;
+                }
+                continue;
+            }
+
+            if (clusterStatus == FlowEvolutionStatus.FAILED) {
+                throw new FlowUpdateException("Flow evolution failed on at 
least one cluster node for " + connector);
+            }
+            if (clusterStatus.ordinal() >= desiredStatus.ordinal()) {
+                logger.info("Flow evolution status for {} is now {}", 
connector, clusterStatus);
+                return;
+            }
+
+            logger.debug("Waiting for {} flow evolution status to become {}; 
current status is {}",
+                    connector, desiredStatus, clusterStatus);
+        }
+    }
+
+    private void sleepForFlowEvolutionPoll(final int pollIndex) throws 
InterruptedException {
+        final Duration interval = 
FLOW_EVOLUTION_POLL_INTERVALS.get(Math.min(pollIndex, 
FLOW_EVOLUTION_POLL_INTERVALS.size() - 1));
+        TimeUnit.NANOSECONDS.sleep(interval.toNanos());
+    }
+
+    private static boolean isNoConnectedNodes(final RuntimeException failure) {

Review Comment:
   [Claude Opus 5.5]  Done. `ConnectorRequestReplicator` now documents a 
dedicated `ConnectorClusterUnavailableException` for the no-connected-nodes 
case, and the repository catches it normally.



-- 
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]

Reply via email to