mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 04:49:05 +01:00
Compute duration for running jobs on the fly
This commit is contained in:
parent
f2d1a85afb
commit
fd94d85edf
@ -80,6 +80,10 @@ func scanJob(row interface{ Scan(...interface{}) error }) (*schema.Job, error) {
|
|||||||
job.RawFootprint = nil
|
job.RawFootprint = nil
|
||||||
|
|
||||||
job.StartTime = time.Unix(job.StartTimeUnix, 0)
|
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
|
return job, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user