1
0
mirror of https://github.com/ClusterCockpit/cc-backend synced 2025-07-26 06:06:15 +02:00

Compute duration for running jobs on the fly

This commit is contained in:
2024-12-19 06:24:08 +01:00
parent f2d1a85afb
commit fd94d85edf

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