mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-24 17:13:30 +01:00
[management] Enforce max conn of 1 for sqlite setups (#2855)
This commit is contained in:
parent
6829a64a2d
commit
7fef8f6758
@ -69,9 +69,17 @@ func NewSqlStore(ctx context.Context, db *gorm.DB, storeEngine StoreEngine, metr
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
conns = runtime.NumCPU()
|
conns = runtime.NumCPU()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if storeEngine == SqliteStoreEngine {
|
||||||
|
if err == nil {
|
||||||
|
log.WithContext(ctx).Warnf("setting NB_SQL_MAX_OPEN_CONNS is not supported for sqlite, using default value 1")
|
||||||
|
}
|
||||||
|
conns = 1
|
||||||
|
}
|
||||||
|
|
||||||
sql.SetMaxOpenConns(conns)
|
sql.SetMaxOpenConns(conns)
|
||||||
|
|
||||||
log.Infof("Set max open db connections to %d", conns)
|
log.WithContext(ctx).Infof("Set max open db connections to %d", conns)
|
||||||
|
|
||||||
if err := migrate(ctx, db); err != nil {
|
if err := migrate(ctx, db); err != nil {
|
||||||
return nil, fmt.Errorf("migrate: %w", err)
|
return nil, fmt.Errorf("migrate: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user