Skip to content

Commit

Permalink
Setup conns according to number of cpus
Browse files Browse the repository at this point in the history
  • Loading branch information
surik committed Sep 14, 2023
1 parent 5efa612 commit 3a112b4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions management/server/sqlite_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package server

import (
"path/filepath"
"runtime"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -41,12 +42,12 @@ func NewSqliteStore(dataDir string, metrics telemetry.AppMetrics) (*SqliteStore,
return nil, err
}

//sql, err := db.DB()
//if err != nil {
// return nil, err
//}
//conns := runtime.NumCPU()
//sql.SetMaxOpenConns(conns) // TODO: make it configurable
sql, err := db.DB()
if err != nil {
return nil, err
}
conns := runtime.NumCPU()
sql.SetMaxOpenConns(conns) // TODO: make it configurable

err = db.AutoMigrate(
&SetupKey{}, &Peer{}, &User{}, &PersonalAccessToken{}, &Group{}, &Rule{},
Expand Down

0 comments on commit 3a112b4

Please sign in to comment.