tisonkun commented on code in PR #446:
URL: https://github.com/apache/curator/pull/446#discussion_r1125475095


##########
curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java:
##########
@@ -237,13 +242,15 @@ private synchronized boolean internalRequeue()
         if ( !isQueued && (state.get() == State.STARTED) )
         {
             isQueued = true;
-            Future<Void> task = executorService.submit(new Callable<Void>()
+            Future<?> oldTask = ourTask;
+            ourTask = executorService.submit(new Callable<Void>()
             {
                 @Override
                 public Void call() throws Exception
                 {
                     try
                     {
+                        waitTaskDone(oldTask, Duration.ofMillis(500), 
Duration.ofSeconds(5));

Review Comment:
   I agree that we can focus on the fix here. Hard-code timeout seems brittle 
also. We can give another round for improvement.



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