ivandika3 commented on code in PR #1669:
URL: https://github.com/apache/ratis/pull/1669#discussion_r4439611165


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java:
##########
@@ -744,19 +744,22 @@ private void updateSenders(RaftConfigurationImpl conf) {
   }
 
   void submitStepDownEvent(StepDownReason reason) {
-    submitStepDownEvent(currentTerm, reason);
-  }
-
-  void submitStepDownEvent(long term, StepDownReason reason) {
-    eventQueue.submit(new StateUpdateEvent(StateUpdateEvent.Type.STEP_DOWN, () 
-> stepDown(term, reason)));
+    eventQueue.submit(new StateUpdateEvent(StateUpdateEvent.Type.STEP_DOWN, () 
-> stepDown(currentTerm, reason)));
   }
 
   private void stepDown(long term, StepDownReason reason) {
     try {
       lease.getAndSetEnabled(false);
+      // The caller may be an appender that is being stopped; do not wait for 
appender cleanup here.
       server.changeToFollowerAndPersistMetadata(term, false, reason)
-          .get(5, TimeUnit.SECONDS);
-      pendingStepDown.complete(server::newSuccessReply);
+          .whenComplete((ignored, exception) -> {
+            if (exception == null) {
+              pendingStepDown.complete(server::newSuccessReply);
+            } else {
+              pendingStepDown.completeExceptionally(new 
CompletionException(exception));

Review Comment:
   Thanks, updated.



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