Was throwing: currval of sequence builds_build_id_seq is not yet defined in this session

This commit is contained in:
Laszlo Fogas 2019-05-30 13:57:52 +02:00
parent f65c4993c1
commit 16d68eddbf
2 changed files with 4 additions and 5 deletions

View file

@ -243,10 +243,6 @@ func setupMetrics(g *errgroup.Group, store_ store.Store) {
pendingJobs.Set(float64(stats.Stats.Pending))
runningJobs.Set(float64(stats.Stats.Running))
workers.Set(float64(stats.Stats.Workers))
buildCount, _ := store_.GetBuildCount()
builds.Set(float64(buildCount))
time.Sleep(500 * time.Millisecond)
}
})
@ -254,6 +250,8 @@ func setupMetrics(g *errgroup.Group, store_ store.Store) {
for {
repoCount, _ := store_.GetRepoCount()
userCount, _ := store_.GetUserCount()
buildCount, _ := store_.GetBuildCount()
builds.Set(float64(buildCount))
users.Set(float64(userCount))
repos.Set(float64(repoCount))
time.Sleep(10 * time.Second)

View file

@ -11,4 +11,5 @@ WHERE repo_active = true
-- name: count-builds
SELECT currval('builds_build_id_seq');
SELECT count(1)
FROM builds