NIFI-8969: Fix Maximum Polling Time in CuratorLeaderElectionManager

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #5270.
This commit is contained in:
Mohammed Nadeem 2021-08-02 12:41:02 +05:30 committed by Pierre Villard
parent 3621a2182c
commit 44f7a2f5b5
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
1 changed files with 2 additions and 3 deletions

View File

@ -330,8 +330,8 @@ public class CuratorLeaderElectionManager implements LeaderElectionManager {
return 0L; return 0L;
} }
final long minNanos = aggregation.getMin(); final long maxNanos = aggregation.getMax();
return timeUnit.convert(minNanos, TimeUnit.NANOSECONDS); return timeUnit.convert(maxNanos, TimeUnit.NANOSECONDS);
} }
@Override @Override
@ -578,7 +578,6 @@ public class CuratorLeaderElectionManager implements LeaderElectionManager {
listener.onLeaderElection(); listener.onLeaderElection();
} catch (final Exception e) { } 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("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); setLeader(false);
Thread.sleep(1000L); Thread.sleep(1000L);
return; return;