markap14 commented on code in PR #10736:
URL: https://github.com/apache/nifi/pull/10736#discussion_r2676408276
##########
nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/components/connector/StandardConnectorValidationTrigger.java:
##########
@@ -42,10 +43,23 @@ public StandardConnectorValidationTrigger(final
ExecutorService threadPool, fina
public void triggerAsync(final ConnectorNode connector) {
if (!flowInitialized.getAsBoolean()) {
logger.debug("Triggered to perform validation on {} asynchronously
but flow is not yet initialized so will ignore validation", connector);
+ threadPool.schedule(() -> triggerAsync(connector), 1,
TimeUnit.SECONDS);
return;
}
- threadPool.submit(() -> trigger(connector));
+ threadPool.submit(() -> {
+ try {
+ if (connector.isValidationPaused()) {
+ logger.debug("Connector {} is currently marked as having
validation paused; will retry in 1 second", connector);
+ threadPool.schedule(() -> triggerAsync(connector), 1,
TimeUnit.SECONDS);
+ }
+
+ trigger(connector);
+ } catch (final Exception e) {
+ logger.error("Validation for connector {} failed; will retry
in 5 seconds", connector, e);
+ threadPool.schedule(() -> triggerAsync(connector), 5,
TimeUnit.SECONDS);
+ }
+ });
}
@Override
Review Comment:
If you're explicitly calling a method to perform validation synchronously it
would be weird for it to just not do it because validation is paused. But it's
fair to expect synchronous and asynchronous to behave the same way unless
otherwise called out, so I will update the Javadocs to make it clear that the
async method is a bit different in that regard.
--
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]