Further optimize queries for better index usage

This commit is contained in:
2026-03-03 15:54:51 +01:00
parent 763e0c8d7c
commit 6da41982ce
2 changed files with 7 additions and 10 deletions

View File

@@ -718,7 +718,7 @@ func (r *JobRepository) StopJobsExceedingWalltimeBy(seconds int) error {
Set("job_state", schema.JobStateFailed).
Where("job.job_state = 'running'").
Where("job.walltime > 0").
Where("(? - job.start_time) > (job.walltime + ?)", currentTime, seconds).
Where("job.start_time < (? - job.walltime)", currentTime-int64(seconds)).
RunWith(r.DB).Exec()
if err != nil {
cclog.Warnf("Error while stopping jobs exceeding walltime: %v", err)