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


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/rpc/LogicITaskInstanceDispatchOperationFunction.java:
##########
@@ -62,19 +62,23 @@ public LogicTaskDispatchResponse 
operate(LogicTaskDispatchRequest taskDispatchRe
             
LogUtils.setTaskInstanceLogFullPathMDC(taskExecutionContext.getLogPath());
 
             
MasterTaskExecutionContextHolder.putTaskExecutionContext(taskExecutionContext);
-            // todo: calculate the delay in master dispatcher then we don't 
need to use a queue to store the task
-            final long remainTime =
-                    
DateUtils.getRemainTime(DateUtils.timeStampToDate(taskExecutionContext.getFirstSubmitTime()),
-                            
TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()));
-            if (remainTime > 0) {
-                log.info("Current taskInstance: {} is choosing delay 
execution, delay time: {}/ms, remainTime: {}/ms",
-                        taskExecutionContext.getTaskName(),
-                        
TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()), remainTime);
-                
taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.DELAY_EXECUTION);
-                // todo: send delay execution message
-                return 
LogicTaskDispatchResponse.success(taskExecutionContext.getTaskInstanceId());
-            }
 
+            int delayTime = taskExecutionContext.getDelayTime();
+            if (delayTime > 0) {
+                // todo: calculate the delay in master dispatcher then we 
don't need to use a queue to store the task
+                final long remainTime =
+                        
DateUtils.getRemainTime(DateUtils.timeStampToDate(taskExecutionContext.getFirstSubmitTime()),
+                                TimeUnit.SECONDS.toMillis(delayTime));
+                if (remainTime > 0) {
+                    log.info(
+                            "Current taskInstance: {} is choosing delay 
execution, delay time: {}/ms, remainTime: {}/ms",
+                            taskExecutionContext.getTaskName(),
+                            
TimeUnit.SECONDS.toMillis(taskExecutionContext.getDelayTime()), remainTime);
+                    
taskExecutionContext.setCurrentExecutionStatus(TaskExecutionStatus.DELAY_EXECUTION);
+                    // todo: send delay execution message
+                    return 
LogicTaskDispatchResponse.success(taskExecutionContext.getTaskInstanceId());
+                }
+            }

Review Comment:
   You also need to add this logic in GlobalTaskInstanceDispatchQueueLooper



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