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


##########
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:
   It's not a good idea to deal with the dispatchFailedQueue in the normal 
process. 
   Most of the time, the failedDispatchQueue is empty, so if you use the 
default dispatchTaskNum -> 3, you will extra wait for 3s in each dispatch, 
since you need to poll the failedDispatchQueue.



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