Skip to content

Commit

Permalink
Was throwing: currval of sequence builds_build_id_seq is not yet defi…
Browse files Browse the repository at this point in the history
…ned in this session
  • Loading branch information
laszlocph committed May 30, 2019
1 parent f65c499 commit 16d68ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions cmd/drone-server/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,15 @@ 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)
}
})
g.Go(func() error {
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)
Expand Down
3 changes: 2 additions & 1 deletion store/datastore/sql/postgres/files/counts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ WHERE repo_active = true

-- name: count-builds

SELECT currval('builds_build_id_seq');
SELECT count(1)
FROM builds

0 comments on commit 16d68ed

Please sign in to comment.