keon94 commented on code in PR #2455:
URL: https://github.com/apache/incubator-devlake/pull/2455#discussion_r934993720
##########
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:
I can do that but I was trying to save DB calls here since this is being
called in a loop. With this code we just make a single call no matter how many
subtasks we have.
--
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]