WangJPLeo commented on code in PR #9955:
URL: https://github.com/apache/dolphinscheduler/pull/9955#discussion_r912602981


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java:
##########
@@ -150,6 +172,20 @@ public List<TaskPriority> batchDispatch(int fetchTaskNum) 
throws TaskPriorityQue
         List<TaskPriority> failedDispatchTasks = 
Collections.synchronizedList(new ArrayList<>());
         CountDownLatch latch = new CountDownLatch(fetchTaskNum);
 
+        // put the failed dispatch task into the dispatch queue again
+        for (int i = 0; i < fetchTaskNum; i++) {
+            TaskPriority dispatchFailedTaskPriority = 
taskPriorityDispatchFailedQueue.poll(Constants.SLEEP_TIME_MILLIS, 
TimeUnit.MILLISECONDS);
+            if (Objects.isNull(dispatchFailedTaskPriority)){
+                continue;
+            }
+            if (canRetry(dispatchFailedTaskPriority)){
+                
dispatchFailedTaskPriority.setDispatchFailedRetryTimes(dispatchFailedTaskPriority.getDispatchFailedRetryTimes()
 + 1);
+                taskPriorityQueue.put(dispatchFailedTaskPriority);
+            } else {
+                
taskPriorityDispatchFailedQueue.put(dispatchFailedTaskPriority);
+            }
+        }

Review Comment:
   This situation may occur, and it is determined whether to traverse by 
judging the size of the Queue that fails to dispatch.



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