mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-03-15 04:17:30 +01:00
Inline jobstate literal in query
Entire-Checkpoint: 35f06df74b51
This commit is contained in:
@@ -1066,7 +1066,7 @@ func (r *JobRepository) GetUsedNodes(ts int64) (map[string][]string, error) {
|
|||||||
// Note: Query expects index on (job_state, start_time) for optimal performance
|
// Note: Query expects index on (job_state, start_time) for optimal performance
|
||||||
q := sq.Select("job.cluster", "job.resources").From("job").
|
q := sq.Select("job.cluster", "job.resources").From("job").
|
||||||
Where("job.start_time < ?", ts).
|
Where("job.start_time < ?", ts).
|
||||||
Where(sq.Eq{"job.job_state": "running"})
|
Where("job.job_state = 'running'")
|
||||||
|
|
||||||
rows, err := q.RunWith(r.stmtCache).Query()
|
rows, err := q.RunWith(r.stmtCache).Query()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ func (r *JobRepository) buildCountQuery(
|
|||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case "running":
|
case "running":
|
||||||
query = query.Where("job.job_state = ?", "running")
|
query = query.Where("job.job_state = 'running'")
|
||||||
case "short":
|
case "short":
|
||||||
query = query.Where("job.duration < ?", config.Keys.ShortRunningJobsDuration)
|
query = query.Where("job.duration < ?", config.Keys.ShortRunningJobsDuration)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user