mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
fix bug in stats AddJobCount
This commit is contained in:
parent
77677a9f1b
commit
a7dd3fbc0b
@ -321,7 +321,7 @@ func (r *JobRepository) AddJobCount(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
counts := make(map[string]int)
|
var count int
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var cnt sql.NullInt64
|
var cnt sql.NullInt64
|
||||||
@ -329,20 +329,22 @@ func (r *JobRepository) AddJobCount(
|
|||||||
log.Warn("Error while scanning rows")
|
log.Warn("Error while scanning rows")
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count = int(cnt.Int64)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case "running":
|
case "running":
|
||||||
for _, s := range stats {
|
for _, s := range stats {
|
||||||
s.RunningJobs = counts[s.ID]
|
s.RunningJobs = count
|
||||||
}
|
}
|
||||||
case "short":
|
case "short":
|
||||||
for _, s := range stats {
|
for _, s := range stats {
|
||||||
s.ShortJobs = counts[s.ID]
|
s.ShortJobs = count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Timer JobJobCount %s", time.Since(start))
|
log.Debugf("Timer AddJobCount %s", time.Since(start))
|
||||||
return stats, nil
|
return stats, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user