fuchanghai commented on code in PR #12264:
URL: https://github.com/apache/dolphinscheduler/pull/12264#discussion_r990877591
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java:
##########
@@ -320,8 +320,11 @@ public Result queryProcessInstanceList(User loginUser,
long projectCode, long pr
}
for (ProcessInstance processInstance : processInstances) {
- processInstance.setDuration(
- DateUtils.format2Duration(processInstance.getStartTime(),
processInstance.getEndTime()));
+ // if processInstance is running, the endTime should be the
current time
+ String duration = processInstance.getState() != null &&
processInstance.getState().isFinished() ?
+ DateUtils.format2Duration(processInstance.getStartTime(),
processInstance.getEndTime()) :
+ DateUtils.format2Duration(processInstance.getStartTime(),
new Date());
Review Comment:
#in the method of DateUtils#format2Duration .when endTime is null will
return new Date. i mean that maybe we can use
```java
DateUtils.format2Duration(processInstance.getStartTime(),
processInstance.getEndTime())
```
instead of
```java
String duration = processInstance.getState() != null &&
processInstance.getState().isFinished() ?
DateUtils.format2Duration(processInstance.getStartTime(),
processInstance.getEndTime()) :
DateUtils.format2Duration(processInstance.getStartTime(), new Date());
```
--
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]