bbende commented on code in PR #11965:
URL: https://github.com/apache/nifi/pull/11965#discussion_r4680317625


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/asset/StandardAssetSynchronizer.java:
##########
@@ -197,26 +313,33 @@ private Asset synchronize(final AssetsRestApiClient 
assetsRestApiClient, final P
         }
     }
 
-    private AssetsEntity listAssetsWithRetry(final AssetsRestApiClient 
assetsRestApiClient, final String parameterContextId) {
+    private AssetsEntity listAssetsWithRetry(final AssetsRestApiClient 
assetsRestApiClient, final String parameterContextId, final boolean 
retryRejectedRequests) {
         final Instant expirationTime = 
Instant.ofEpochMilli(System.currentTimeMillis() + 
LIST_ASSETS_RETRY_DURATION.toMillis());
         while (System.currentTimeMillis() < expirationTime.toEpochMilli()) {
-            final AssetsEntity assetsEntity = listAssets(assetsRestApiClient, 
parameterContextId);
+            final AssetsEntity assetsEntity = listAssets(assetsRestApiClient, 
parameterContextId, retryRejectedRequests);
             if (assetsEntity != null) {
                 return assetsEntity;
             }
-            logger.info("Unable to list assets from cluster coordinator for 
parameter context [{}]: retrying until [{}]", parameterContextId, 
expirationTime);
+            logger.info("Unable to list assets for parameter context [{}]: 
retrying until [{}]", parameterContextId, expirationTime);
             sleep(Duration.ofSeconds(5));
         }
         return null;
     }
 
-    private AssetsEntity listAssets(final AssetsRestApiClient 
assetsRestApiClient, final String parameterContextId) {
+    private AssetsEntity listAssets(final AssetsRestApiClient 
assetsRestApiClient, final String parameterContextId, final boolean 
retryRejectedRequests) {
         try {
             return 
assetsRestApiClient.getParameterContextAssets(parameterContextId);
         } catch (final NiFiRestApiRetryableException e) {
             final Throwable rootCause = ExceptionUtils.getRootCause(e);
             logger.warn("{}, root cause [{}]: retrying", e.getMessage(), 
rootCause.getMessage());
             return null;
+        } catch (final IllegalStateException e) {
+            if (!retryRejectedRequests) {

Review Comment:
   Yes, will update. The fix is to retry 404 and fail fast on everything else. 
NiFiRestApiClient currently throws a plain IllegalStateException with the 
status code only in the message. The clean way is to throw a small subclass of 
IllegalStateException that carries the status code, rather than parsing the 
message. Existing callers, including the NAR client, still catch 
IllegalStateException, so they're unaffected. The same change applies to 
listConnectorAssets.



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