This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 44f7a2f  NIFI-8969: Fix Maximum Polling Time in 
CuratorLeaderElectionManager
44f7a2f is described below

commit 44f7a2f5b5882e5ca7fdd217f61bd6df0d9dc26b
Author: Mohammed Nadeem <[email protected]>
AuthorDate: Mon Aug 2 12:41:02 2021 +0530

    NIFI-8969: Fix Maximum Polling Time in CuratorLeaderElectionManager
    
    Signed-off-by: Pierre Villard <[email protected]>
    
    This closes #5270.
---
 .../controller/leader/election/CuratorLeaderElectionManager.java     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/leader/election/CuratorLeaderElectionManager.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/leader/election/CuratorLeaderElectionManager.java
index d0c38a2..a8f5790 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/leader/election/CuratorLeaderElectionManager.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/leader/election/CuratorLeaderElectionManager.java
@@ -330,8 +330,8 @@ public class CuratorLeaderElectionManager implements 
LeaderElectionManager {
             return 0L;
         }
 
-        final long minNanos = aggregation.getMin();
-        return timeUnit.convert(minNanos, TimeUnit.NANOSECONDS);
+        final long maxNanos = aggregation.getMax();
+        return timeUnit.convert(maxNanos, TimeUnit.NANOSECONDS);
     }
 
     @Override
@@ -578,7 +578,6 @@ public class CuratorLeaderElectionManager implements 
LeaderElectionManager {
                     listener.onLeaderElection();
                 } catch (final Exception e) {
                     logger.error("This node was elected Leader for Role '{}' 
but failed to take leadership. Will relinquish leadership role. Failure was due 
to: {}", roleName, e);
-                    logger.error("", e);
                     setLeader(false);
                     Thread.sleep(1000L);
                     return;

Reply via email to