mjsax commented on code in PR #23093:
URL: https://github.com/apache/kafka/pull/23093#discussion_r3737219407


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java:
##########
@@ -716,9 +718,18 @@ private Task checkIfTaskFailed(final 
StateUpdater.RemovedTaskResult removedTaskR
 
     private StateUpdater.RemovedTaskResult waitForFuture(final TaskId taskId,
                                                          final 
CompletableFuture<StateUpdater.RemovedTaskResult> future) {
-        final StateUpdater.RemovedTaskResult removedTaskResult;
+        StateUpdater.RemovedTaskResult removedTaskResult;
         try {
-            removedTaskResult = future.get(5, TimeUnit.MINUTES);
+            long minutesWaited = 0L;
+            while (true) {
+                try {
+                    removedTaskResult = 
future.get(REMOVAL_LOG_INTERVAL_MINUTES, TimeUnit.MINUTES);
+                    break;
+                } catch (final java.util.concurrent.TimeoutException 
retryTimeout) {
+                    minutesWaited += REMOVAL_LOG_INTERVAL_MINUTES;
+                    log.warn("Waiting for the removal of task {} from the 
state updater for {} minute(s).", taskId, minutesWaited);
+                }
+            }
             if (removedTaskResult == null) {

Review Comment:
   Nit (also from Claude): we can move this check inside the loop, including 
`return removedTaskResult;` plus the declaration of the variable, and can use 
`final StateUpdater.RemovedTaskResult removedTaskResult = 
future.get(REMOVAL_LOG_INTERVAL_MINUTES, TimeUnit.MINUTES);`.
   
   Might make the code a little cleaner?



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