klesh commented on code in PR #2455:
URL: https://github.com/apache/incubator-devlake/pull/2455#discussion_r935043588


##########
runner/run_task.go:
##########
@@ -292,3 +301,28 @@ func UpdateProgressDetail(db *gorm.DB, logger core.Logger, 
taskId uint64, progre
                progressDetail.SubTaskNumber = p.SubTaskNumber
        }
 }
+
+func runSubtask(
+       parentID uint64,
+       ctx core.SubTaskContext,
+       entryPoint core.SubTaskEntryPoint,
+) (*models.Subtask, error) {
+       beginAt := time.Now()
+       subtask := &models.Subtask{
+               Name:    ctx.GetName(),
+               TaskID:  parentID,
+               BeganAt: &beginAt,
+       }
+       defer func() {
+               finishedAt := time.Now()
+               subtask.FinishedAt = &finishedAt
+               subtask.SpentSeconds = finishedAt.Unix() - beginAt.Unix()

Review Comment:
   It is ok because each iteration took quite some time to finish, we would 
like the information to be saved into the database as soon as the subtask is 
finished, or it would be gone if any of these subtasks went south.



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