Add debug output to duration query

This commit is contained in:
Jan Eitzinger 2024-09-05 11:18:00 +02:00
parent 508978d586
commit 53ca38ce53

View File

@ -484,10 +484,14 @@ func (r *JobRepository) FindRunningJobs(cluster string) ([]*schema.Job, error) {
} }
func (r *JobRepository) UpdateDuration() error { func (r *JobRepository) UpdateDuration() error {
if _, err := sq.Update("job"). stmnt := sq.Update("job").
Set("duration", sq.Expr("? - job.start_time", time.Now().Unix())). Set("duration", sq.Expr("? - job.start_time", time.Now().Unix())).
Where("job_state = running"). Where("job_state = running")
RunWith(r.stmtCache).Exec(); err != nil { sql, _, err := stmnt.ToSql()
log.Infof("Duration Update query %s", sql)
_, err = stmnt.RunWith(r.stmtCache).Exec()
if err != nil {
return err return err
} }