You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/09/13 13:58:19 UTC

[GitHub] [dolphinscheduler] SbloodyS commented on a diff in pull request #11747: [Feature][Api] Refactor org.apache.dolphinscheduler.api.controller.TaskInstanceController

SbloodyS commented on code in PR #11747:
URL: https://github.com/apache/dolphinscheduler/pull/11747#discussion_r969666387


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java:
##########
@@ -182,19 +182,19 @@ public Result queryTaskListPaging(User loginUser,
     /**
      * change one task instance's state from failure to forced success
      *
-     * @param loginUser login user
-     * @param projectCode project code
+     * @param loginUser      login user
+     * @param projectCode    project code
      * @param taskInstanceId task instance id
      * @return the result code and msg
      */
     @Transactional
     @Override
-    public Map<String, Object> forceTaskSuccess(User loginUser, long projectCode, Integer taskInstanceId) {
+    public Result forceTaskSuccess(User loginUser, long projectCode, Integer taskInstanceId) {
+        Result result = new Result();
         Project project = projectMapper.queryByCode(projectCode);
         // check user access for project
-        Map<String, Object> result =
-                projectService.checkProjectAndAuth(loginUser, project, projectCode, FORCED_SUCCESS);
-        if (result.get(Constants.STATUS) != Status.SUCCESS) {
+        projectService.checkProjectAndAuth(result, loginUser, project, projectCode, FORCED_SUCCESS);

Review Comment:
   > I found they are these two function is the same except that result handles it differently, and I think the return result one is better, because the input parameter cannot be modified directly in general.
   > 
   > WDYT? @SbloodyS
   
   Agreed.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org