markap14 commented on code in PR #10815:
URL: https://github.com/apache/nifi/pull/10815#discussion_r2760030802


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorRepository.java:
##########
@@ -224,22 +224,9 @@ private void waitForState(final ConnectorNode connector, 
final Set<ConnectorStat
     }
 
     private void cleanUpAssets(final ConnectorNode connector) {
-        final FrameworkFlowContext activeFlowContext = 
connector.getActiveFlowContext();
-        final ConnectorConfiguration activeConfiguration = 
activeFlowContext.getConfigurationContext().toConnectorConfiguration();
-
         final Set<String> referencedAssetIds = new HashSet<>();
-        for (final NamedStepConfiguration namedStepConfiguration : 
activeConfiguration.getNamedStepConfigurations()) {
-            final StepConfiguration stepConfiguration = 
namedStepConfiguration.configuration();
-            final Map<String, ConnectorValueReference> stepPropertyValues = 
stepConfiguration.getPropertyValues();
-            if (stepPropertyValues == null) {
-                continue;
-            }
-            for (final ConnectorValueReference valueReference : 
stepPropertyValues.values()) {
-                if (valueReference instanceof AssetReference assetReference) {
-                    
referencedAssetIds.addAll(assetReference.getAssetIdentifiers());
-                }
-            }
-        }
+        collectReferencedAssetIds(connector.getActiveFlowContext(), 
referencedAssetIds);
+        collectReferencedAssetIds(connector.getWorkingFlowContext(), 
referencedAssetIds);

Review Comment:
   Yeah, I think you're right. I'm trying to remember the exact reason for 
this. I know I did it when tracking down a bug in which Assets were being 
removed when they shouldn't be, and that's resolved here. Given where it's 
called from it may be that this was not the actual root cause. However, I do 
believe this is a safer approach, in case it's ever called in the future in a 
way where that assertion (that active and working have the same reference) does 
not hold.



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