Skip to content

Commit

Permalink
Compute duration for running jobs on the fly
Browse files Browse the repository at this point in the history
  • Loading branch information
moebiusband73 committed Dec 19, 2024
1 parent f2d1a85 commit fd94d85
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/repository/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func scanJob(row interface{ Scan(...interface{}) error }) (*schema.Job, error) {
job.RawFootprint = nil

job.StartTime = time.Unix(job.StartTimeUnix, 0)
// Always ensure accurate duration for running jobs
if job.State == schema.JobStateRunning {
job.Duration = int32(time.Since(job.StartTime).Seconds())
}

return job, nil
}
Expand Down

0 comments on commit fd94d85

Please sign in to comment.